<template>
  <div class="page-container">
    <!--面包屑导航-->
    <div class="breadcrumb">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item>会员中心</el-breadcrumb-item>
        <el-breadcrumb-item>会员积分管理</el-breadcrumb-item>
        <el-breadcrumb-item>积分规则列表</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <!--工具栏-->
    <div class="toolbar">
      <el-form :inline="true" :model="filters" :size="size" ref="filters" >
        <el-row class="search-input longInput">

          <el-form-item label="规则名称：">
            <el-input v-model="filters.ruleName" placeholder="规则名称" maxlength="80" clearable></el-input>
          </el-form-item>


          <el-form-item label="规则类型：">
            <el-select v-model="filters.ruleType" placeholder="全部" clearable>
              <el-option label="积分获取" value="1"></el-option>
              <el-option label="积分消耗" value="2"></el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="状态：" prop="status" label-width="60px">
            <el-select v-model="filters.status" placeholder="全部" clearable>
              <el-option label="启用" value="1"></el-option>
              <el-option label="停用" value="0"></el-option>
            </el-select>
          </el-form-item>

          <el-form-item prop="obtainMode" label="获取方式">
            <el-select
              v-model="filters.obtainMode"
              clearable
              placeholder="请选择获取方式"
              :size="size"
            >
              <el-option
                v-for="item in obtainModeTypeList"
                :key="item.obtainMode"
                :label="item.obtainName"
                :value="item.obtainMode"
              ></el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="消耗方式" prop="consumeMode">

            <el-select
              v-model="filters.consumeMode"
              :size="size"
              clearable
            >
              <el-option
                v-for="item in consumeModeTypeList"
                :key="item.consumeMode"
                :label="item.consumeName"
                :value="item.consumeMode"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-row>

        <el-row>
          <el-form-item label="创建时间：" prop="startTime">
            <el-date-picker
              v-model="filters.startTime"
              type="datetime"
              placeholder="开始时间"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              clearable
              @change="changeStartDate"
              :picker-options="startDateDisabled"
            ></el-date-picker>
          </el-form-item>
          <span class="times-to">-</span>
          <el-form-item prop="endTime">
            <el-date-picker
              v-model="filters.endTime"
              type="datetime"
              placeholder="结束时间"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              clearable
              @change="changeEndDate"
              :picker-options="endDateDisabled"
            ></el-date-picker>
          </el-form-item>

        </el-row>

        <el-row class="search-button-noborder" style="text-align: right">
          <el-form-item>
            <kt-button
              icon="el-icon-search"
              :label="'搜索'"
              type="primary"
              @click="findPageClick()"
              :size="size"
            />
          </el-form-item>
          <el-form-item>
            <kt-button
              :label="$t('action.reset')"
              type="primary"
              @click="resetForm('filters')"
              plain
              :size="size"
            />
          </el-form-item>
          <el-form-item>
            <kt-button label="添加积分获取规则" type="primary" @click="addRule()" :size="size" />
          </el-form-item>
          <el-form-item >
            <kt-button label="添加积分消耗规则" type="primary" @click="addConsumeRule()" :size="size" />
          </el-form-item>
        </el-row>
        <!--表格+分页器-->
        <div style="width:100%">
          <!--表格-->
          <el-table
            :data="tableData"
            :header-cell-style="{ 'color': '#FFF','background-color': '#409EFF','text-align': 'center'}"
            :highlight-current-row="true"
            :max-height="1500"
            :size="'mini'"
            style="width: 100%"
            class="specicalTable"
            v-loading="loading"
          >
            <el-table-column align="center" label="规则名称" width="160" element-loading-text>
              <template slot-scope="scope">
                <span>{{ scope.row.ruleName }}</span>
              </template>
            </el-table-column>

            <el-table-column align="center" label="规则类型" width="200">
              <template slot-scope="scope">
                <span v-show="scope.row.ruleType == '1'">积分获取</span>
                <span v-show="scope.row.ruleType == '2'">积分消耗</span>
              </template>
            </el-table-column>

            <el-table-column  align="center" label="获取方式">
              <template slot-scope="scope">
                <span
                  v-show="scope.row.obtainMode != '' && null != scope.row.obtainMode  "
                >{{ scope.row.obtainModeName}}</span>
                <span v-show="scope.row.obtainMode == '' || null == scope.row.obtainMode  ">-</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="消耗方式">
              <template slot-scope="scope">
                <span
                  v-show="scope.row.consumeMode != '' && null != scope.row.consumeMode  "
                >{{ scope.row.obtainModeName}}</span>
                <span v-show="scope.row.consumeMode == '' || null == scope.row.consumeMode  ">-</span>
              </template>
            </el-table-column>

            <el-table-column  align="center" label="创建时间">
              <template slot-scope="scope">
                <span>{{ scope.row.createTime}}</span>
              </template>
            </el-table-column>

            <el-table-column
              align="center"
              label="状态"
            >
              <template slot-scope="scope">
                <span >{{scope.row.status == 1?"启用":"停用"}}</span>
              </template>
            </el-table-column>

            <el-table-column
              align="center"
              label="操作"
            >
              <template slot-scope="scope">
                <kt-button
                  @click="handleDetail(scope.row)"
                  type="text"
                  size="mini"
                  style
                  label="查看"
                ></kt-button>
                <kt-button
                  @click="handleEdit(scope.row)"
                  type="text"
                  size="mini"
                  style
                  label="编辑"
                  :disabled="scope.row.status == 1"
                ></kt-button>
                <kt-button
                  @click="handleDeleteParams(scope.row)"
                  type="text"
                  size="mini"
                  style
                  label="删除"
                  :disabled="scope.row.status == 1"
                ></kt-button>

                <kt-button
                  @click="handleStatus (scope.row ,'启用')"
                  type="text"
                  size="mini"
                  style
                  label="启用"
                  v-show="scope.row.status == 0"
                ></kt-button>
                <kt-button
                  @click="handleProhibitStatus(scope.row , '停用')"
                  type="text"
                  size="mini"
                  style
                  label="停用"
                  v-show="scope.row.status == 1"
                ></kt-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="toolbar" style="padding:10px;">
            <el-pagination
              layout="total, sizes, prev, pager, next, jumper"
              @current-change="currentChange"
              :current-page="filters.start"
              :page-size="filters.limit"
              :total="totalSize"
              style="float:right;"
              :page-sizes="[10, 20, 30, 40]"
              @size-change="sizeChange"
            ></el-pagination>
          </div>
        </div>
      </el-form>
    </div>

    <!--新增积分获取规则-->
    <el-dialog
      :title="addIntegraTitle"
      :visible.sync="rulePowerVisible"
      :close-on-click-modal="false"
      @closed="handleClose"
      class="el-dialog-tab"
    >
    </el-dialog>
    <!--编辑积分规则-->
    <el-dialog
      title="查看规则"
      class="el-dialog-style"
      :visible.sync="editDialogVisible"
      :close-on-click-modal="false"
      @closed="handleCloseEdit"
    >
      <el-form :model="dataForm" :rules="dataFormRules" ref="dataForm" :size="size">
        <el-row>
          <el-form-item label="所属平台：" prop="ruleName" label-width="128px" class="mb30" >
            <span class="color333 alignment">{{dataForm.deptName}}</span>
          </el-form-item>
        </el-row>
        <div
           v-if="dataForm.obtainMode != null && dataForm.consumeMode == null || dataForm.consumeMode == ''"
          class="mb30"
        >
          <el-form-item label="获取/消耗方式：" prop="ruleName" class="w326" >
            <el-select
              v-model="dataForm.obtainMode"
              @change="selectModel($event)"
              :disabled="true"
              :size="size"
            >
              <el-option
                v-for="item in obtainModeTypeList"
                :key="item.obtainMode"
                :label="item.obtainName"
                :value="item.obtainMode"
              ></el-option>
            </el-select>
          </el-form-item>
        </div>
        <div
           v-if="dataForm.consumeMode != null && dataForm.obtainMode == null || dataForm.obtainMode =='' "
          class="mb30"
        >
          <el-form-item label="获取/消耗方式：" prop="ruleName" class="w326" >
            <el-select
              v-model="dataForm.consumeMode"
              @change="selectconsumeMode($event)"
              :disabled="true"
              :size="size"
            >
              <el-option
                v-for="item in consumeModeTypeList"
                :key="item.consumeMode"
                :label="item.consumeName"
                :value="item.consumeMode"
              ></el-option>
            </el-select>
          </el-form-item>
        </div>

        <el-row>
          <el-form-item label="规则名称："  prop="ruleName" class=" w326">
            <el-input
              v-model="dataForm.ruleName"
              auto-complete="off"
              :disabled="detailDis"
              maxlength="20"
              clearable
              style="width: 300px"
            ></el-input>
          </el-form-item>
        </el-row>
        <!--评价赠送-->
        <el-row  v-if="this.dataForm.obtainMode == 3">
          <el-form>
            <el-checkbox-group v-model="whetherPicList">
              <el-form-item >
                <!-- <span class="font">评价赠送</span> -->
                <el-row class="mb30">
                  <el-checkbox label="带图" :disabled="detailDis"></el-checkbox>
                </el-row>
                <el-form-item class="mb30 w280" label="完成评价赠送：" :required="true" :show-message="false" label-width="129px">
                  <!-- <span class="labelText color333 turnInlineBlock w129 t_r"><span style="color:red">*</span>完成评价赠送：</span> -->
                  <el-input
                    placeholder="输入数字"
                    v-model="dataForm.havePictureMaxNum"
                    @input="dataForm.havePictureMaxNum=dataForm.havePictureMaxNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                    :disabled="detailDis"
                  ></el-input>
                  <span class="labelText turnInlineBlock m_l10 color333">积分</span>
                </el-form-item>
              </el-form-item>
              <el-form-item >
                <el-form-item class="mb30 w280" label="每日上限：" :required="true" :show-message="false" label-width="129px">
                  <!-- <span class="labelText w125 color333">每日上限：</span -->
                  <el-input
                    placeholder="输入数字"
                    v-model="dataForm.havePictureGiveGrowthNum"
                    @input="dataForm.havePictureGiveGrowthNum=dataForm.havePictureGiveGrowthNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                    :disabled="detailDis"
                  ></el-input>
                  <span class="labelText turnInlineBlock m_l10 color333">积分</span>
                </el-form-item>
              </el-form-item>

              <el-form-item >
                <el-row class="mb30">
                  <el-checkbox label="不带图" :disabled="detailDis"></el-checkbox>
                </el-row>
                <el-form-item class="mb30 w280" label="完成评价赠送：" :required="true" :show-message="false" label-width="129px">
                  <!-- <span class="labelText color333 turnInlineBlock w129 t_r"><span style="color:red">*</span>完成评价赠送：</span> -->
                  <el-input
                    placeholder="输入数字"
                    v-model="dataForm.giveGrowthNum"
                    @input="dataForm.giveGrowthNum=dataForm.giveGrowthNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                    :disabled="detailDis"
                  ></el-input>
                  <span class="labelText turnInlineBlock m_l10 color333">积分</span>
                </el-form-item>
              </el-form-item>
              <el-form-item >
                <el-form-item class="mb120 w280" label="每日上限：" :required="true" :show-message="false" label-width="129px">
                  <!-- <span class="labelText w125 color333"></span> -->
                  <el-input
                    placeholder="输入数字"
                    v-model="dataForm.giveGrowthMaxNum"
                    @input="dataForm.giveGrowthMaxNum=dataForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                    :disabled="detailDis"
                  ></el-input>
                  <span class="labelText turnInlineBlock m_l10 color333">积分</span>
                </el-form-item>
              </el-form-item>
            </el-checkbox-group>
          </el-form>
        </el-row>
        <!--充值赠送-->
        <el-row  v-if="this.dataForm.obtainMode == 4">
          <!-- <el-form-item >
            <span class="font">充值赠送</span>
          </el-form-item>-->
          <el-form-item class="mb30">
            <el-radio-group v-model="dataForm.consumeFlag">
              <el-radio label="1" class="form-radio mr60" :disabled="detailDis">每充值赠送</el-radio>
              <el-radio label="2" class="form-radio" :disabled="detailDis">阶梯充值赠送</el-radio>
            </el-radio-group>
          </el-form-item>
          <!--  -->
          <el-form-item v-if="dataForm.consumeFlag==1">
            <el-form-item label="每充值：" prop="ruleName" label-width="117px" class="mb30">
              <el-input
                placeholder="请输入"
                clearable
                class="editDialogInput125"
                v-model="dataForm.consumeNum"
                @input="dataForm.consumeNum=dataForm.consumeNum.replace(/[^\d.]/g,'')"
                maxlength="5"
                :disabled="detailDis"
                
              ></el-input>
              <span class="font16 color333 turnInlineBlock m_l10">元，赠送</span>
              <el-input
                placeholder="请输入"
                clearable
                class="editDialogInput125"
                v-model="dataForm.giveIntegralNum"
                @input="dataForm.giveIntegralNum=dataForm.giveIntegralNum.replace(/[^\d.]/g,'')"
                maxlength="5"
                :disabled="detailDis"
                
              ></el-input>
              <span class="font16 color333 turnInlineBlock m_l10">积分</span>
            </el-form-item>
            <el-form-item label="每日上限：" prop="ruleName" class="mb120 w326" label-width="117px">
              <el-input
                placeholder="请输入"
                v-model="dataForm.giveIntegralMaxNum"
                @input="dataForm.giveIntegralMaxNum=dataForm.giveIntegralMaxNum.replace(/[^\d.]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
              ></el-input>
            </el-form-item>
          </el-form-item>
          <!--  -->
          <el-form-item  v-if="dataForm.consumeFlag==2">
            <div v-for="(item,index) in dataForm.mememberIntegraIncrement" :key="index">
              <!-- <el-form-item  required> -->
              <el-form-item
                label="充值赠送："
                prop="ruleName"
                label-width="117px"
                class="mb30 turnInlineBlock"
              >
                <el-input
                  type="text"
                  v-model.number="dataForm.mememberIntegraIncrement[index].consumeNum"
                  maxlength="5"
                  placeholder="请输入"
                  oninput="value=value.replace(/[^\d]/g,'')"
                  clearable
                  class="editDialogInput78 inputInner_paddingRight16"
                  :disabled="detailDis"
                ></el-input>
                <span class="font16 color333 turnInlineBlock m_l10 mr10">元，赠送</span>
              </el-form-item>
              <el-form-item prop="giveIntegralNum" class="turnInlineBlock">
                <el-input
                  type="text"
                  v-model.number="dataForm.mememberIntegraIncrement[index].giveIntegralNum"
                  maxlength="5"
                  placeholder="请输入"
                  oninput="value=value.replace(/[^\d]/g,'')"
                  clearable
                  class="editDialogInput78 inputInner_paddingRight16"
                  :disabled="detailDis"
                ></el-input>
                <span class="font16 color333 turnInlineBlock m_l10">积分</span>
              </el-form-item>
              <el-button
                :size="size"
                type="text"
                @click="addOrderGivenStairArr(index)"
                v-show="index==0"
                :disabled="detailDis"
              >添加</el-button>
              <el-button
                :size="size"
                type="text"
                @click="deelteOrderGivenStairArr(index)"
                v-show="index != 0"
                class="textRed noMarginL"
                :disabled="detailDis"
              >删除</el-button>
              <!-- </el-form-item> -->
            </div>
            <el-form-item label="每日上限：" prop="ruleName" class="mb120 w326" label-width="117px">
              <el-input
                placeholder="请输入"
                v-model="dataForm.giveIntegralMaxNum"
                @input="dataForm.giveIntegralMaxNum=dataForm.giveIntegralMaxNum.replace(/[^\d.]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
              ></el-input>
            </el-form-item>
          </el-form-item>
        </el-row>

        <!--下单赠送-->
        <el-row  v-if="this.dataForm.obtainMode == 1">

          <el-form-item class="mb30">
            <el-radio-group v-model="dataForm.orderFlag">
              <el-radio label="1" class="form-radio mr60" :disabled="detailDis">每消费赠送</el-radio>
              <el-radio label="2" class="form-radio" :disabled="detailDis">阶梯消费赠送</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item  v-if="dataForm.orderFlag==1">
            <!-- <span style="color:red">*</span> -->
            <el-form-item label="每消费：" prop="ruleName" label-width="128px" class="mb30 turnInlineBlock" >
              <el-input
                placeholder="请输入"
                clearable
                v-model="dataForm.consumeNum"
                class="editDialogInput125"
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                :disabled="detailDis"
              ></el-input>
              <span class="font16 color333 turnInlineBlock m_l10">元，赠送</span>
              <el-input
                placeholder="请输入"
                clearable
                v-model="dataForm.giveIntegralNum"
                maxlength="5"
                class="editDialogInput125"
                oninput="value=value.replace(/[^\d]/g,'')"
                :disabled="detailDis"
              ></el-input>
              <span class="font16 color333 turnInlineBlock m_l10">积分</span>
            </el-form-item>
            <el-form-item label="每日上限：" prop="ruleName" class="w326 mb120" label-width="128px">
              <el-input
                placeholder="请输入"
                v-model="dataForm.giveIntegralMaxNum"
                maxlength="5"
                clearable
                oninput="value=value.replace(/[^\d]/g,'')"
                :disabled="detailDis"
              ></el-input>
            </el-form-item>
          </el-form-item>
          <el-form-item  v-if="dataForm.orderFlag==2">
            <div v-for="(item,index) in dataForm.mememberIntegraIncrement" :key="index">
              <el-form-item class="formItemNoMargin">
                <el-form-item
                  label="消费："
                  prop="consumeNum"
                  class="mb30 turnInlineBlock width267"
                  label-width="128px"
                >
                  <el-input
                    type="text"
                    v-model.number="dataForm.mememberIntegraIncrement[index].consumeNum"
                    maxlength="5"
                    placeholder="请输入"
                    class="editDialogInput78 inputInner_paddingRight16"
                    clearable
                    oninput="value=value.replace(/[^\d]/g,'')"
                    :disabled="detailDis"
                  ></el-input>
                  <span class="font16 color333">元，赠送</span>
                </el-form-item>
                <el-form-item prop="giveIntegralNum" class="turnInlineBlock">
                  <el-input
                    type="text"
                    clearable
                    v-model.number="dataForm.mememberIntegraIncrement[index].giveIntegralNum"
                    maxlength="5"
                    placeholder="请输入"
                    class="editDialogInput78 inputInner_paddingRight16"
                    oninput="value=value.replace(/[^\d]/g,'')"
                    :disabled="detailDis"
                  ></el-input>
                  <span class="font16 color333 turnInlineBlock m_l10">积分</span>
                </el-form-item>
                <el-button
                  :size="size"
                  type="text"
                  @click="addOrderGivenStairArr(index)"
                  v-show="index==0"
                  :disabled="detailDis"
                >添加</el-button>
                <el-button
                  :size="size"
                  type="text"
                  class="textRed noMarginL"
                  @click="deelteOrderGivenStairArr(index)"
                  v-show="index != 0"
                  :disabled="detailDis"
                >删除</el-button>
              </el-form-item>
            </div>
            <el-form-item label="每日上限：" prop="ruleName" label-width="128px" class="w326 mb120">
              <el-input
                placeholder="请输入"
                clearable
                v-model="dataForm.giveIntegralMaxNum"
                maxlength="5"
                :disabled="detailDis"
              ></el-input>
            </el-form-item>
          </el-form-item>
        </el-row>
        <!--注册赠送-->
        <el-row  v-if="this.dataForm.obtainMode == 2">
          <!-- <el-form-item>
            <span class="font">注册赠送</span>
          </el-form-item>-->
          <el-form-item label="用户注册发放：" prop="ruleName" class="w280 mb120" label-width="129px">
            <el-input
              placeholder="请输入"
              clearable
              v-model="dataForm.giveIntegralNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 tuenInlineBlock m_l10">积分</span>
          </el-form-item>
        </el-row>
        <!--消费抵现-->
        <el-row  v-if="this.dataForm.consumeMode == 1">
          <!-- <el-form-item >
            <span class="font">消费抵现</span>
          </el-form-item>-->
          <el-form-item label="订单消耗积分上限：" prop="ruleName" class="w200 mb120">
            <el-input
              placeholder="请输入"
              v-model="dataForm.consumeIntegralMaxNum"
              clearable
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
              
            ></el-input>
            <span class="turnInlineBlock m_l10 font16 color333">积分</span>
          </el-form-item>
        </el-row>
        <!--兑换优惠券-->
        <el-row  v-if="this.dataForm.consumeMode == 2">
          <!-- <span class="font">兑换优惠券、红包</span> -->
          <el-form-item class="mb30">
            <el-radio-group v-model="dataForm.exchangeType">
              <el-radio label="1" class="form-radio mr60 color333" :disabled="detailDis">按比例兑换</el-radio>
              <el-radio label="2" class="form-radio color333" :disabled="detailDis">固定数额兑换</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item  v-if="dataForm.exchangeType ==1" class="mb120">
            <el-form-item label="兑换比例：" class="input100" label-width="128px" >
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeIntegral"
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
                
              ></el-input>
              <span class="color333 font16 m_l10 mr5">积分</span>
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeMoney"
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
                
              ></el-input>
              <span class="color333 font16 m_l10">金额</span>
            </el-form-item>
          </el-form-item>
          <el-form-item  v-if="dataForm.exchangeType == 2">
            <el-form-item label="消耗：" class="input100" label-width="116px">
              <el-input
                placeholder="请输入"
                v-model="dataForm.consumeIntegralNum"
                oninput="value=value.replace(/[^\d]/g,'')"
                clearable
                maxlength="5"
                class="mr10"
                :disabled="detailDis"
              ></el-input>
              <span class="color333 font16">积分，兑换优惠券/红包</span>
            </el-form-item>
            <el-form-item label="兑换优惠券/红包编码：" prop="ruleName" class="mb120 w150">
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeCouponRedEnvelopes"
                clearable
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                :disabled="detailDis"
                
              ></el-input>
            </el-form-item>
          </el-form-item>
        </el-row>
        <!--红包-->
        <el-row  v-if="this.dataForm.consumeMode == 3">
          <!-- <span class="font">兑换优惠券、红包</span> -->
          <el-form-item class="mb30">
            <el-radio-group v-model="dataForm.exchangeType">
              <el-radio :label="1" class="form-radio mr60 color333" :disabled="detailDis">按比例兑换</el-radio>
              <el-radio :label="2" class="form-radio color333" :disabled="detailDis">固定数额兑换</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item  v-if="dataForm.exchangeType ==1" class="mb120">
            <el-form-item label="兑换比例：" prop="ruleName" class="input100" label-width="128px" >
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeIntegral"
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
              ></el-input>
              <span class="color333 font16 m_l10 mr5">积分</span>
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeMoney"
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                clearable
                :disabled="detailDis"
              ></el-input>
              <span class="color333 font16 m_l10">金额</span>
            </el-form-item>
          </el-form-item>
          <el-form-item  v-if="dataForm.exchangeType == 2">
            <el-form-item label="消耗：" class="input100" label-width="117px" >
              <el-input
                placeholder="请输入"
                v-model="dataForm.consumeIntegralNum"
                oninput="value=value.replace(/[^\d]/g,'')"
                clearable
                maxlength="5"
                class="mr10"
                :disabled="detailDis"
              ></el-input>
              <span class="color333 font16">积分，兑换优惠券/红包</span>
            </el-form-item>
            <el-form-item label="兑换优惠券/红包编码：" prop="ruleName" class="mb120 w150">
              <el-input
                placeholder="请输入"
                v-model="dataForm.exchangeCouponRedEnvelopes"
                clearable
                oninput="value=value.replace(/[^\d]/g,'')"
                maxlength="5"
                :disabled="detailDis"
              ></el-input>
            </el-form-item>
          </el-form-item>
        </el-row>
        <!--点赞-->
        <el-row  v-if="this.dataForm.obtainMode == 6">
          <el-form-item label="完成点赞，赠送：" prop="ruleName" class="mb30 w200">
            <el-input
              placeholder="请输入"
              v-model="dataForm.giveIntegralNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              clearable
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
            <!-- <el-input placeholder="请输入" v-model="dataForm.giveIntegralMaxNum" oninput="value=value.replace(/[^\d]/g,'')" clearable maxlength="5" ></el-input><span>每日上限积分</span> -->
          </el-form-item>
          <el-form-item label="每日上限：" prop="ruleName" class="mb120 w200" label-width="128px">
            <el-input
              clearable
              placeholder="请输入"
              v-model="dataForm.giveIntegralMaxNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
          </el-form-item>
        </el-row>
        <!--晒单-->
        <el-row  v-if="this.dataForm.obtainMode == 7">
          <el-form-item label="完成嗮单，赠送：" prop="ruleName" class="mb30 w200">
            <el-input
              placeholder="请输入"
              v-model="dataForm.giveIntegralNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              clearable
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
            <!-- <el-input placeholder="请输入" v-model="dataForm.giveIntegralMaxNum" oninput="value=value.replace(/[^\d]/g,'')" clearable maxlength="5" ></el-input><span>每日上限积分</span> -->
          </el-form-item>
          <el-form-item label="每日上限：" prop="ruleName" class="mb120 w200" label-width="128px">
            <el-input
              clearable
              placeholder="请输入"
              v-model="dataForm.giveIntegralMaxNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
          </el-form-item>
        </el-row>
        <!--搜藏-->
        <el-row  v-if="this.dataForm.obtainMode == 8">
          <el-form-item label="完成收藏，赠送：" prop="ruleName" class="mb30 w200">
            <el-input
              placeholder="请输入"
              v-model="dataForm.giveIntegralNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
            <!-- <el-input placeholder="请输入" v-model="dataForm.giveIntegralMaxNum" oninput="value=value.replace(/[^\d]/g,'')" maxlength="5" style="width:200px"></el-input><span>每日上限积分</span> -->
          </el-form-item>
          <el-form-item label="每日上限：" prop="ruleName" class="mb120 w200" label-width="128px">
            <el-input
              clearable
              placeholder="请输入"
              v-model="dataForm.giveIntegralMaxNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
          </el-form-item>
        </el-row>
        <!--分享-->
        <el-row  v-if="this.dataForm.obtainMode == 5">
          <el-form-item label="完成分享，赠送：" prop="ruleName" class="mb30 w200">
            <el-input
              clearable
              placeholder="请输入"
              v-model="dataForm.giveIntegralNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
          </el-form-item>
          <el-form-item label="每日上限：" prop="ruleName" class="mb120 w200" label-width="128px">
            <el-input
              clearable
              placeholder="请输入"
              v-model="dataForm.giveIntegralMaxNum"
              oninput="value=value.replace(/[^\d]/g,'')"
              maxlength="5"
              :disabled="detailDis"
            ></el-input>
            <span class="font16 color333 turnInlineBlock m_l10">积分</span>
          </el-form-item>
        </el-row>
        <!-- 自定义获取-->
        <el-row  v-if="customize">
          <el-form>
            <el-form-item >
              <el-row class="mb30">
                <span class="font16 color000">{{this.obtainName}}赠送</span>
              </el-row>
              <el-form-item class="everyCostHandleSel mb30">
                <span style="color:red">*</span>
                <span>{{this.obtainName}}，赠送</span>
                <el-input
                  placeholder="输入数字"
                  v-model="dataForm.giveIntegralNum"
                   @input="dataForm.giveIntegralNum=dataForm.giveIntegralNum.replace(/[^\d.]/g,'')"
                  maxlength="5"
                  
                  :disabled="detailDis"
                ></el-input>
                <span>积分</span>
              </el-form-item>
            </el-form-item>
            <el-form-item >
              <el-form-item class="everyCostHandleSel mb120">
                <span class="w115">每日上限：</span>
                <el-input
                  placeholder="输入数字"
                  v-model="dataForm.giveIntegralMaxNum"
                  @input="dataForm.giveIntegralMaxNum=dataForm.giveIntegralMaxNum.replace(/[^\d.]/g,'')"
                  maxlength="5"
                  :disabled="detailDis"
                ></el-input>
                <span>积分</span>
              </el-form-item>
            </el-form-item>
          </el-form>
        </el-row>

        <!-- 自定义消耗 -->
        <el-row  v-if="conCustize">
          <el-form>
            <el-form-item >
              <!-- <span class="font">收藏赠送</span> -->
              <el-form-item class="everyCostHandleSel mb20">
                <span style="color:red">*</span>
                <span class="labelText">{{this.consumeName}},消耗</span>
                <el-input
                  placeholder="输入数字"
                  v-model="dataForm.consumeIntegralMaxNum"
                  
                  oninput="value=value.replace(/[^\d]/g,'')"
                  maxlength="5"
                  clearable
                  :disabled="detailDis"
                ></el-input>
                <span class="labelText">积分</span>
              </el-form-item>
            </el-form-item>
          </el-form>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer t_c">
        <el-button
          :size="size"
          @click.native="editDialogVisible = false"
          plain
          type="primary"
          v-show="detailOperate"
        >{{$t('action.cancel')}}</el-button>
        <el-button
          :size="size"
          type="primary"
          @click.native="submitForm"
          :loading="editLoading"
          v-show="detailOperate"
        >{{$t('action.submit')}}</el-button>
      </div>
      <div  v-if="acSure" class="dialog-footer t_c">
        <el-button
          :size="size"
          type="primary"
          @click.native="editDialogVisible = false"
          :loading="editLoading"
        >确定</el-button>
      </div>
    </el-dialog>

    <!-- 新增积分消耗规则-->
    <el-dialog
      :title="addIntegraDelTitle"
      :visible.sync="crulePowerVisible"
      :close-on-click-modal="false"
      @closed="handleClose"
      class="el-dialog-tab"
    >
      <el-tabs v-model="activeName">
        <el-tab-pane label="选择规则类型" name="first" :disabled="true">
          <el-form
            ref="crulePowerForm"
            :model="crulePowerForm"
            class="dataForm"
          >

            <el-form-item
              class="mb30 w326 labelTextSize14 errorInfoPosition labelColor666"
            >
              <span style="color:red">*</span>
              <span class="color666 font14">消耗方式：</span>
              <el-select
                v-model="crulePowerForm.consumeMode"
                @change="selectconsumeMode($event)"
                placeholder="请选择消耗方式"
                :size="size"
                clearable
                :disabled="editTypeDis"
              >
                <el-option
                  v-for="item in consumeModeTypeList"
                  :key="item.consumeMode"
                  :label="item.consumeName"
                  :value="item.consumeMode"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item class="mb120 w326 labelTextSize14 labelColor666">
              <span style="color:red">*</span>
              <span class="font14 color666">规则名称：</span>
              <el-input v-model="crulePowerForm.ruleName" clearable placeholder="请输入规则名称" style="width: 300px" maxlength="20" :size="size"></el-input>
            </el-form-item>
            <div class="t_c">
              <el-button
                :size="size"
                @click.native="crulePowerVisible = false"
                plain
                type="primary"
                class="mr60"
              >{{ $t("action.cancel") }}</el-button>
              <el-button
                :size="size"
                type="primary"
                @click="cnextStepRulePower(1)"
                :loading="ceditLoading"
              >下一步</el-button>
            </div>
          </el-form>
        </el-tab-pane>

        <el-tab-pane label="设置规则" :disabled="true" name="second">
          <el-form
            ref="crulePowerForm"
            :model="crulePowerForm"
            :size="size"
          >
            <el-row v-show="red">
              <el-row class="mb30">
                <span class="font16 color000">兑换红包</span>
              </el-row>
              <el-form-item class="formItemNoMargin">
                <el-radio-group v-model="crulePowerForm.exchangeType" class="mb30">
                  <el-radio label="1" class="form-radio mr60 color333">按比例兑换</el-radio>
                  <el-radio label="2" class="form-radio color333">固定数额兑换</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-show="crulePowerForm.exchangeType==1">
                <el-form-item  class="labelTextSize14 labelTextColor666 w200 mb120">
                  <span style="color:red">*</span>
                <span class="color333">兑换比例：</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.exchangeIntegral"
                    maxlength="5"
                     @input="crulePowerForm.exchangeIntegral=crulePowerForm.exchangeIntegral.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBLock m_l10 mr10">积分</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.exchangeMoney"
                    maxlength="5"
                     @input="crulePowerForm.exchangeMoney=crulePowerForm.exchangeMoney.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBlock m_l10">金额</span>
                </el-form-item>
              </el-form-item>
              <el-form-item v-show="crulePowerForm.exchangeType==2">
                <el-form-item
                  
                  class="labelTextColor666 labelTextSize14 w200 mb30"
                  label-width="112px"
                >
                  <span style="color:red">*</span>
                  <span class="color333">消耗：</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.consumeIntegralNum"
                    oninput="value=value.replace(/[^\d]/g,'')"
                    maxlength="5"
                    @input="crulePowerForm.consumeIntegralNum=crulePowerForm.consumeIntegralNum.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBlock m_l10">积分，兑换优惠券/红包</span>
                </el-form-item>
                <el-form-item  class="labelTextColor666 labelTextSize14 mb120">
                  <span style="color:red">*</span>
                  <span class="color333">兑换优惠券编码：</span>
                  <el-input
                    clearable
                    v-model="crulePowerForm.exchangeCouponRedEnvelopes"
                    class="w356"
                    oninput="value=value.replace(/[^\d]/g,'')"
                    maxlength="5"
                    @input="crulePowerForm.exchangeCouponRedEnvelopes=crulePowerForm.exchangeCouponRedEnvelopes.replace(/[^\d.]/g,'')"
                  ></el-input>
                </el-form-item>
              </el-form-item>
            </el-row>

            <el-row v-show="coupon">
              <el-row class="mb30">
                <span class="font16 color000">兑换优惠券</span>
              </el-row>
              <el-form-item class="formItemNoMargin">
                <el-radio-group v-model="crulePowerForm.exchangeType" class="mb30">
                  <el-radio label="1" class="form-radio mr60 color333">按比例兑换</el-radio>
                  <el-radio label="2" class="form-radio color333">固定数额兑换</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-show="crulePowerForm.exchangeType==1">
                <el-form-item  class="labelTextSize14 labelTextColor666 w200 mb120">
                  <span style="color:red">*</span>
                  <span class="color333">兑换比例：</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.exchangeIntegral"
                    maxlength="5"
                    @input="crulePowerForm.exchangeIntegral=crulePowerForm.exchangeIntegral.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBLock m_l10 mr10">积分</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.exchangeMoney"
                    maxlength="5"
                    @input="crulePowerForm.exchangeMoney=crulePowerForm.exchangeMoney.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBlock m_l10">金额</span>
                </el-form-item>
              </el-form-item>
              <el-form-item v-show="crulePowerForm.exchangeType==2">
                <el-form-item
                  
                  class="labelTextColor666 labelTextSize14 w200 mb30"
                  label-width="112px"
                >
                  <span style="color:red">*</span>
                  <span class="color333">消耗：</span>
                  <el-input
                    placeholder="输入数字"
                    clearable
                    v-model="crulePowerForm.consumeIntegralNum"
                    maxlength="5"
                    @input="crulePowerForm.consumeIntegralNum=crulePowerForm.consumeIntegralNum.replace(/[^\d.]/g,'')"
                  ></el-input>
                  <span class="turnInlineBlock m_l10">积分，兑换优惠券/红包</span>
                </el-form-item>
                <el-form-item  class="labelTextColor666 labelTextSize14 mb120">
                  <span style="color:red">*</span>
                  <span class="color333">兑换优惠券编码：</span>
                  <el-input
                    clearable
                    v-model="crulePowerForm.exchangeCouponRedEnvelopes"
                    class="w356"
                    oninput="value=value.replace(/[^\d]/g,'')"
                    maxlength="5"
                    @input="crulePowerForm.exchangeCouponRedEnvelopes=crulePowerForm.exchangeCouponRedEnvelopes.replace(/[^\d.]/g,'')"
                  ></el-input>
                </el-form-item>
              </el-form-item>
            </el-row>

            <el-row v-show="consume">
              <el-row class="mb30">
                <span class="font16 color000">消费抵现</span>
              </el-row>
              <el-row>
                <el-form-item
                  prop="consumeIntegralMaxNum"
                  class="labelTextColor666 labelTextSize14 w200"
                >
                  <span style="color:red">*</span>
                  <span class="color333">每笔订单需满足：</span>
                  <el-input
                    placeholder="输入数字"
                    v-model="crulePowerForm.giveIntegralNum"
                    @input="crulePowerForm.giveIntegralNum=crulePowerForm.giveIntegralNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                  ></el-input>
                  <span class="turnInlineBlock m_l10">积分，才能使用。</span>
                </el-form-item>
              </el-row>

              <el-row>
                <el-form-item
                  prop="consumeIntegralMaxNum"
                  class="labelTextColor666 labelTextSize14 w200"
                >
                  <span style="color:red">*</span>
                  <span class="color333">订单消耗积分上限：</span>
                  <el-input
                    placeholder="输入数字"
                    v-model="crulePowerForm.consumeIntegralMaxNum"
                    @input="crulePowerForm.consumeIntegralMaxNum=crulePowerForm.consumeIntegralMaxNum.replace(/[^\d.]/g,'')"
                    maxlength="5"
                    clearable
                  ></el-input>
                  <span class="turnInlineBlock m_l10">积分</span>
                </el-form-item>
              </el-row>
            </el-row>
            <!-- product -->
            <el-row v-show="product">
              <el-form-item class="mb30">
                <span class="font16 color000">兑换产品功能</span>
              </el-form-item>
              <el-form-item  class="labelTextSize14 labelTextColor666 w200 mb30">
                <span style="color:red">*</span>
                <span class="color333">消耗：</span>
                <el-input
                  placeholder="请输入"
                  v-model="crulePowerForm.consumeIntegralNum"
                  @input="crulePowerForm.consumeIntegralNum=crulePowerForm.consumeIntegralNum.replace(/[^\d.]/g,'')"
                  maxlength="5"
                  clearable
                ></el-input>
                <span class="turnInlineBlock m_l10">积分</span>
              </el-form-item>
              <el-form-item label="兑换：" class="labelTextSize14 labelTextColor666 w200">
                <!--<el-select>-->
                  <!--<option></option>功能-->
                <!--</el-select>-->
              </el-form-item>
            </el-row>
            <!-- Pay -->
            <el-row v-show="Pay">
              <el-form-item>
                <span class="font16 color000">兑换付费内容</span>
              </el-form-item>
              <el-form-item  class="labelTextSize14 labelTextColor666 w200 mb30">
                <span style="color:red">*</span>
                <span class="color333">消耗：</span>
                <el-input
                  placeholder="请输入"
                  v-model="crulePowerForm.consumeIntegralNum"
                  maxlength="5"
                  clearable
                ></el-input>
                <span class="turnInlineBlock m_l10">积分</span>
              </el-form-item>
              <el-form-item label="兑换：" class="labelTextSize14 labelTextColor666 w200">
                <!--<el-select>-->
                  <!--<option></option>功能-->
                <!--</el-select>-->
              </el-form-item>
            </el-row>
            <!-- 自定义消耗 -->
            <el-row v-show="conCustize">
              <el-form>
                <el-form-item >
                  <el-form-item class="mb30">
                    <span class="font16 color000">积分消耗</span>
                  </el-form-item>
                  <!-- <span class="font">收藏赠送</span> -->
                  <el-form-item class="everyCostHandleSel mb120">
                    <span style="color:red">*</span>
                    <span
                      class="labelTextSize14 labelTextColor666"
                    >{{this.consumeName}}消耗：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="crulePowerForm.consumeIntegralMaxNum"
                      
                      oninput="value=value.replace(/[^\d]/g,'')"
                      maxlength="5"
                      clearable
                    ></el-input>
                    <span class="font14 color666">&nbsp;&nbsp;积分</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
          </el-form>
          <div class="t_c">
            <el-button
              :size="size"
              type="primary"
              @click="cupStep(2)"
              :loading="ceditLoading"
              class="mr60"
            >上一步</el-button>
            <el-button
              :size="size"
              type="primary"
              @click="cnextStepRulePower(2)"
              :loading="ceditLoading"
              v-show="cdetailShow "
              class="mr60"
            >下一步</el-button>
            <el-button
              :size="size"
              type="primary"
              @click="creturnRuleList"
              v-show="!cdetailShow"
            >返回规则列表</el-button>
          </div>
        </el-tab-pane>

        <el-tab-pane :label="addRuleSuccess" :disabled="true" name="third">
          <div class="positionDes">
            <span class="ruleClass font16">
              <img src="../../../../assets/success.png" class="successImg" />
              <span v-show="addSuccess == true">规则创建成功</span>
              <span v-show="addSuccess == false">规则创建成功</span>
            </span>
            <img v-bind:src="imgUrl" />
          </div>
          <div class="positionDes">
            <span
              class="ruleDes font12 colorOrange mb120 turnInlineBlock"
              v-show="addSuccess == true"
            >该规则现为【停用】状态，请手动操作【启用】</span>
          </div>
          <div class="positionDes">
            <el-button :size="size" type="primary" @click="creturnRuleList('crulePowerForm')">知道了</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>

  </div>
</template>

<script>
import CyTable from "@/views/Core/JicTable";
import KtButton from "@/views/Core/KtButton";
import { format } from "@/utils/datetime";
import TableColumnFilterDialog from "@/views/Core/TableColumnFilterDialog";
import TreeSelect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
  components: {
    CyTable,
    TreeSelect,
    KtButton,
    TableColumnFilterDialog
  },
  data() {
    
    return {
      addDisabled:false,
      startDateDisabled: {},//开始时间限制
      endDateDisabled: {},//结束时间限制
      loading:true,
      filtersRules: {

      },
      addRuleSuccess: "创建成功",
      addSuccess: true,
      addIntegraTitle: "添加积分获取规则", //弹窗规则名称
      addIntegraDelTitle: "添加积分消耗规则",
      editTypeDis: false, //规则获取方式默认可选取
      searchDeptDis: false,
      acSure: false, //查看详情 确定按钮
      detailOperate: true,
      detailDis: false,
      conCustize: false, //自定义消耗
      customize: false, //自定义赠送
      /* 自定义规则名称 */
      obtainName: null,
      consumeName: null,
      // 搜索表单对应的数据对象
      obtainModeList: [],
      /* 操作按钮是否显示 */
      isNeedAudit: false,
      operateDis: true,
      statusOperate1: true,
      statusOperate2: false,
      disabled: true,
      whetherPicList: [],
      consumeIntegralNum: null,
      consumeModeTypeList: [],
      deptOption: [],
      obtainMode: null,
      consumeMode: null,
      ruleName: null,
      consumeFlag: null,
      orderFlag: null,
      share: false,
      editShopping: false,
      editIntegral: false,
      editLogistics: false,
      editActivity: false,
      editContent: false,
      editGrade: false,
      editService: false,
      red: false,
      coupon: false,
      product: false,
      Pay: false,
      consume: false,
      sun: false,
      recharge: false,
      evaluate: false,
      give: false,
      order: false,
      collection: false,
      praise: false,
      detailShow: true,
      cdetailShow: true,
      rulePowerShowRemark: "",
      imgUrl: "",
      havePictureMaxNum: null,
      havePictureGiveGrowthNum: null,
      giveGrowthNum: null,
      obtainModeTypeList: [
        {
          "obtainMode": 1,
          "obtainName": "下单赠送"
        },{
          "obtainMode": 2,
          "obtainName": "注册赠送"
        },{
          "obtainMode": 3,
          "obtainName": "评价赠送"
        },
        {
          "obtainMode": 5,
          "obtainName": "分享赠送"
        },{
          "obtainMode": 6,
          "obtainName": "点赞赠送"
        },

        {
          "obtainMode": 8,
          "obtainName": "收藏赠送"
        },
      ],
      consumeModeTypeList: [
        {
          "consumeMode": 1,
          "consumeName": "消费抵现金"
        }
      ],
      activeName: "first",
      deptMsg: localStorage.getItem("user"), //当前登录组织信息
      deptType: localStorage.getItem("deptType"), //当前登录用户所属组织类型
      fileList: [],
      childOptions: [],
      content: null,
      size: "mini",
      filters: {
        startTime: null,
        endTime: null,
        ruleNum: null,
        ruleName: null,
        ruleType: null,
        obtainMode: null,
        obtainModeName: null,
        consumeMode: null,
        start: 1,
        limit: 10,
      },
      crulePowerForm: {
        consumeIntegralNum: null,
        orderConsume: null,
        deptName: null,
        ruleType: 2,
        exchangeType:"1",
        ruleName: null,
        ruleNum: null,
        consumeIntegralMaxNum: null,
        exchangeIntegral: null,
        exchangeCouponRedEnvelopes: null,
        exchangeName: null,
        giveIntegralMaxNum: null,
        giveIntegralNum: null,
        consumeMode: null,
        obtainMode: null,
        exchangeMoney: null,
        giveGrowthMaxNum: null
      },
      rulePowerForm: {
        consumeIntegralNum: null,
        ruleType: 1,
        orderConsume: null,
        deptName: null,
        mememberIntegraIncrement: [{ consumeNum: "", giveIntegralNum: "" }],
        consumeFlag: null,
        orderFlag: null,
        flag: null,
        share: null,
        consumeNum: null,
        phasedConsumeNum: null,
        ruleName: null,
        ruleNum: null,
        giveIntegralNum: null,
        giveIntegralMaxNum: null,
        consumeMode: null,
        obtainMode: null,
        giveGrowthMaxNum: null,
        notPictureGiveGrowthNum: null,
        havePictureMaxNum: null,
        havePictureGiveGrowthNum: null,
        giveGrowthNum: null,
        obtainModeName: null,
        exchangeType: 1,
      },
      tableData: [],
      totalSize: 0,
      filterColumns: [],
      pageRequest: { pageNum: 1, pageSize: 10 },
      pageResult: {},
      rulePowerFormRules: {

      },
      crulePowerFormRules: {

      },
      value: 0,
      rulePowerVisible: false,
      crulePowerVisible: false,
      printPage: false,
      operation: false, // true:新增, false:编辑
      editDialogVisible: false, // 新增编辑界面是否显示
      ceditDialogVisible: false, // 新增编辑界面是否显示
      editLoading: false,
      ceditLoading: false,
      // 新增编辑界面数据
      dataForm: {
        disabled: true,
        consumeIntegralNum: null,
        giveGrowthNum: null,
        havePictureMaxNum: null,
        havePictureGiveGrowthNum: null,
        giveGrowthMaxNum: null,
        giveType: null,
        actionType: null,
        giveMaxNum: null,
        consumeNum: null,
        giveNum: null,
        share: null,
        ruleId: null,
        ruleType: null,
        obtainMode: null,
        consumeMode: null,
        deptName: null,
        ruleName: null,
        ruleValue: null,
        consumeFlag: null,
        orderFlag: null,
        flag: null,
        exchangeType: 1,
        exchangeMoney: null,
        exchangeCouponRedEnvelopes: null,
        exchangeIntegral: null,
        giveIntegralNum: null,
        consumeIntegralMaxNum: null,
        giveIntegralMaxNum: null,
        consumeModeTypeList: [],
        obtainModeTypeList: [],
        mememberIntegraIncrement: [{ consumeNum: "", giveIntegralNum: "" }]
      },
      dataFormRules: {
        ruleName: [
          { required: true, message: "请输入规则名称", trigger: "blur" }
        ],
        ruleValue: [
          { required: true, message: "请输入必填项", trigger: "blur" }
        ]
      },
      cdataFormRules: {
        ruleName: [
          { required: true, message: "请输入规则名称", trigger: "blur" }
        ],
        ruleValue: [
          { required: true, message: "请输入必填项", trigger: "blur" }
        ]
      },
      checked: []
    };
  },
  methods: {
    changeStartDate: function() {
      var this_ = this;
      this_.endDateDisabled = {
        disabledDate: time => {
          if (this_.filters.startTime) {
            return time.getTime() <= new Date(this_.filters.startTime).getTime();
          }
        }
      };
    },
    changeEndDate: function() {
      var this_ = this;
      this_.startDateDisabled = {
        disabledDate: time => {
          if (this_.filters.endTime) {
            return time.getTime() >= new Date(this_.filters.endTime).getTime();
          }
        }
      };
    },
    //分页
    currentChange(start) {
      this.filters.start = start;
      this.findPage();
    },
    sizeChange(limit) {
      this.filters.start = 1;
      this.filters.limit = limit;
      this.findPage();
    },

    //格式化组织初查询条件
    normalizer(node) {
      if (node.children == null || node.children.length == 0) {
        delete node.children;
      }
      return {
        id: node.id,
        label: node.label,
        children: node.children
      }
    },
    //input框视图强制刷新
    updateVal() {
      this.$forceUpdate();
    },
    // 时间判断
    checkStartTime: function() {
      let this_ = this;
      if ("" != this_.filters.startTime) {
        let minTime = new Date(this_.filters.startTime).getTime();
        let maxTime = new Date(this_.filters.endTime).getTime();

        if (minTime > maxTime && maxTime != 0) {
          this_.$message({
            message: "起始时间不能大于结束时间 ",
            type: "error"
          });
          this_.filters.startTime = null;
        }
      }
    },
    checkEndTime: function() {
      let this_ = this;
      let maxTime = new Date(this_.filters.startTime).getTime();
      let minTime = new Date(this_.filters.endTime).getTime();
      if (minTime < maxTime && minTime != 0) {
        this_.$message({
          message: "结束时间不能小于起始时间 ",
          type: "error"
        });
        this_.filters.endTime = null;
      }
    },
    checkRegisteredVal(val) {
      let this_ = this;
      this_.$forceUpdate();
    },

    //编辑方法分步骤 ceditDialogVisible
    handleEdit: function(data) {

      let queryParams = {ruleId:data.id,ruleType:data.courseKey,ruleMode:data.obtainMode};
      this.$router.push({path: "/CourseOrderUpdate/",query:queryParams});

      let this_ = this;
      this_.addIntegraTitle = "编辑积分获取规则";
      this_.addIntegraDelTitle = "编辑积分消耗规则";
      this_.addRuleSuccess = "修改成功";
      this_.addSuccess = false;
      this_.editTypeDis = true;
      this_.rulePowerForm.orderFlag = 0;
      this_.rulePowerForm.consumeFlag = 0;
      this.crulePowerForm.exchangeType = 0;
      this_.acSure = false;
      this_.detailOperate = true;
      this_.detailDis = false;

      let query = {};
      if (data.ruleType == 1) {
        //如果是获取规则
        this_.rulePowerVisible = true;
        this.rulePowerForm.deptName = data.deptName;
        this.rulePowerForm.ruleName = data.ruleName;
        this.rulePowerForm.ruleType = data.ruleType;
        this.rulePowerForm.ruleId = data.ruleId;
        this.rulePowerForm.obtainMode = data.obtainMode;
        this.rulePowerForm.consumeMode = data.consumeMode;
        this.rulePowerForm.consumeFlag = data.consumeFlag;
      } else if (data.ruleType == 2) {
        this_.crulePowerVisible = true;
        this.crulePowerForm.deptName = data.deptName;
        this.crulePowerForm.ruleName = data.ruleName;
        this.crulePowerForm.ruleType = data.ruleType;
        this.crulePowerForm.ruleId = data.ruleId;
        this.crulePowerForm.obtainMode = data.obtainMode;
        this.crulePowerForm.consumeMode = data.consumeMode;
        this.crulePowerForm.consumeFlag = data.consumeFlag;
      }

      if ("" != data.obtainMode) {
        this.selectModel(data.obtainMode);
        this.obtainModeTypeList.find(item => {
            if (item.obtainMode == data.obtainMode) {
              this.rulePowerForm.obtainMode = item.obtainName;
            }})
      } else if ("" != data.consumeMode) {
        this.selectconsumeMode(data.consumeMode);
        this.consumeModeTypeList.find(item => {
          if (item.consumeMode == data.consumeMode) {
            this.crulePowerForm.consumeMode =  item.consumeName;
          }})
      }
      //查询数据渲染表格orderFlag
      query.ruleType = data.ruleType;
      query.ruleId = data.ruleId;
      query.obtainMode = data.obtainMode;
      query.consumeMode = data.consumeMode;

      this.utils.request.queryMemberIntegralInfo(query, function(res) {
        if (
          "" == res.data.giveIntegralMaxNum ||
          null == res.data.giveIntegralMaxNum
        ) {
          res.data.giveIntegralMaxNum = null;
        }
        if (res.code == "0000") {
          if (
            res.data.actionType == 5 ||
            res.data.actionType == 6 ||
            res.data.actionType == 7 ||
            res.data.actionType == 8 ||
            res.data.actionType > 8
          ) {
            this_.rulePowerForm.ruleId = res.data.ruleId;
            this_.rulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
            this_.rulePowerForm.giveIntegralMaxNum =res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
            this_.crulePowerForm.ruleId = res.data.ruleId;
            this_.crulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
            this_.crulePowerForm.giveIntegralMaxNum =res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
          }

          if (query.obtainMode == 1) {
            //下单赠送
            if (1 == res.data.consumeFlag) {
              this_.rulePowerForm.orderFlag = "1";
              this_.rulePowerForm.ruleId = res.data.ruleId;
              this_.rulePowerForm.consumeNum = res.data.consumeNum;
              this_.rulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
              this_.rulePowerForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
            } else if (2 == res.data.consumeFlag) {
              this_.rulePowerForm.orderFlag = "2";
              this_.rulePowerForm.ruleId = res.data.ruleId;
              this_.rulePowerForm.consumeNum = null;
              this_.rulePowerForm.giveIntegralNum = null;
              this_.rulePowerForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
              this_.rulePowerForm.mememberIntegraIncrement =
                res.data.mememberIntegraIncrement.length == 0
                  ? this_.rulePowerForm.mememberIntegraIncrement
                  : res.data.mememberIntegraIncrement;
            }
          }
          if (query.obtainMode == 2) {
            //注册赠送
            this_.rulePowerForm.ruleId = res.data.ruleId;
            this_.rulePowerForm.consumeNum = res.data.consumeNum;
            this_.rulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
            this_.rulePowerForm.giveIntegralMaxNum =res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
          }
          //
          if (res.data.actionType == 3) {
            //评价赠送赠送
            this_.rulePowerForm.ruleId = res.data.ruleId;
            this_.whetherPicList = [];
            if (res.data.flag == 1) {
              this_.rulePowerForm.flag = res.data.flag;
              this_.whetherPicList.push("带图");
              this_.rulePowerForm.havePictureMaxNum = res.data.giveGrowthNum;
              this_.rulePowerForm.havePictureGiveGrowthNum =
                res.data.giveGrowthMaxNum ==0? null: res.data.giveGrowthMaxNum;
            }
            if (res.data.flag == 2) {
              this_.rulePowerForm.flag = res.data.flag;
              this_.whetherPicList.push("不带图");
              this_.rulePowerForm.giveGrowthMaxNum = res.data.giveGrowthMaxNum ==0? null: res.data.giveGrowthMaxNum;
              this_.rulePowerForm.giveGrowthNum = res.data.giveGrowthNum;
            }
            if (res.data.flag == 3) {
              this_.rulePowerForm.flag = res.data.flag;
              this_.whetherPicList.push("带图");
              this_.whetherPicList.push("不带图");
              this_.rulePowerForm.havePictureMaxNum =
                res.data.havePictureMaxNum;
              this_.rulePowerForm.havePictureGiveGrowthNum =
                res.data.havePictureGiveGrowthNum;
              this_.rulePowerForm.giveGrowthMaxNum = res.data.giveGrowthMaxNum ==0? null: res.data.giveGrowthMaxNum;
              this_.rulePowerForm.giveGrowthNum = res.data.giveGrowthNum;
            }
          }
          if (query.consumeMode == 1 || query.consumeMode > 8) {
            //消费抵现
            this_.crulePowerForm.ruleId = res.data.ruleId;
            this_.crulePowerForm.consumeIntegralMaxNum = res.data.consumeIntegralMaxNum;
            this_.crulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
          }
          if (query.obtainMode == 4) {
            //充值赠送
            if (1 == res.data.consumeFlag) {
              this_.rulePowerForm.ruleId = res.data.ruleId;
              this_.rulePowerForm.consumeNum = res.data.consumeNum;
              this_.rulePowerForm.consumeFlag = res.data.consumeFlag + "";
              this_.rulePowerForm.giveIntegralNum = res.data.giveIntegralNum;
              this_.rulePowerForm.giveIntegralMaxNum =
                res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
            } else {
              this_.rulePowerForm.consumeFlag = 2 + "";
              this_.rulePowerForm.ruleId = res.data.ruleId;
              this_.rulePowerForm.giveIntegralMaxNum =
                res.data.giveIntegralMaxNum == 0?null : res.data.giveIntegralMaxNum;
              this_.rulePowerForm.mememberIntegraIncrement =
                res.data.mememberIntegraIncrement.length == 0
                  ? this_.rulePowerForm.mememberIntegraIncrement
                  : res.data.mememberIntegraIncrement;
            }
          }

          if (query.consumeMode == 2) {
            //  兑换优惠券
            if (res.data.exchangeType == 1) {
              this_.crulePowerForm.ruleId = res.data.ruleId;
              this_.crulePowerForm.exchangeIntegral = res.data.exchangeIntegral;
              this_.crulePowerForm.exchangeType = 1 + "";
              this_.crulePowerForm.exchangeMoney = res.data.exchangeMoney;
            }
            if (res.data.exchangeType == 2) {
              this_.crulePowerForm.ruleId = res.data.ruleId;
              this_.crulePowerForm.consumeIntegralNum =
                res.data.consumeIntegralNum;
              this_.crulePowerForm.exchangeType = 2 + "";
              this_.crulePowerForm.exchangeCouponRedEnvelopes =
                res.data.exchangeCouponRedEnvelopes;
            }
          }
          if (query.consumeMode == 3) {
            // 红包
            if (res.data.exchangeType == 1) {
              this_.crulePowerForm.ruleId = res.data.ruleId;
              this_.crulePowerForm.exchangeIntegral = res.data.exchangeIntegral;
              this_.crulePowerForm.exchangeType = 1 + "";
              this_.crulePowerForm.exchangeMoney = res.data.exchangeMoney;
            }
            if (res.data.exchangeType == 2) {
              this_.crulePowerForm.ruleId = res.data.ruleId;
              this_.crulePowerForm.consumeIntegralNum =
                res.data.consumeIntegralNum;
              this_.crulePowerForm.exchangeType = 2 + "";
              this_.crulePowerForm.exchangeCouponRedEnvelopes =
                res.data.exchangeCouponRedEnvelopes;
            }
          }
        }
      });
    },
    //点击搜索，页码重置
    findPageClick(){
      this.filters.start = 1;
      this.findPage();
    },

    //查看方法
    handleDetail: function(data) {
      let this_ = this;
      this_.acSure = true;
      this_.detailOperate = false;
      this_.detailDis = true;
      let query = {};
      this.dataForm.orderFlag = data.orderFlag;
      this.dataForm.deptName = data.deptName;
      this.dataForm.ruleName = data.ruleName;
      this.dataForm.ruleType = data.ruleType;
      this.dataForm.ruleId = data.ruleId;
      this.dataForm.obtainMode = data.obtainMode;
      this.dataForm.consumeMode = data.consumeMode;
      this.dataForm.consumeFlag = data.consumeFlag;
      if ("" != data.obtainMode) {
        this.selectModel(data.obtainMode);
      } else if ("" != data.consumeMode) {
        this.selectconsumeMode(data.consumeMode);
      }
      //查询数据渲染表格orderFlag
      query.ruleType = data.ruleType;
      query.ruleId = data.ruleId;
      query.obtainMode = data.obtainMode;
      query.consumeMode = data.consumeMode;

      this.utils.request.queryMemberIntegralInfo(query, function(res) {
        if (res.code == "0000") {
          if (
            res.data.actionType == 5 ||
            res.data.actionType == 6 ||
            res.data.actionType == 7 ||
            res.data.actionType == 8 ||
            res.data.actionType > 8
          ) {
            this_.dataForm.ruleId = res.data.ruleId;
            this_.dataForm.giveIntegralNum = res.data.giveIntegralNum;
            this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum;
          }

          if (query.obtainMode == 1) {
            this_.addDisabled=true;
            //下单赠送
            if (1 == res.data.consumeFlag) {
              this_.dataForm.orderFlag = "1";
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.consumeNum = res.data.consumeNum;
              this_.dataForm.giveIntegralNum = res.data.giveIntegralNum;
              this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum == 0 ? null : res.data.giveIntegralMaxNum;
            } else if (2 == res.data.consumeFlag) {
              this_.dataForm.orderFlag = "2";
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.consumeNum = null;
              this_.dataForm.giveIntegralNum = null;
              this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum == 0 ? null : res.data.giveIntegralMaxNum;
              this_.dataForm.mememberIntegraIncrement =
                res.data.mememberIntegraIncrement.length == 0
                  ? this_.dataForm.mememberIntegraIncrement
                  : res.data.mememberIntegraIncrement;
            }
          }

          if (query.obtainMode == 2) {
            //注册赠送
            this_.dataForm.ruleId = res.data.ruleId;
            this_.dataForm.consumeNum = res.data.consumeNum;
            this_.dataForm.giveIntegralNum = res.data.giveIntegralNum;
            this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum;
          }
          //
          if (res.data.actionType == 3) {
            
            //评价赠送赠送
            this_.dataForm.ruleId = res.data.ruleId;
            this_.whetherPicList = [];
            if (res.data.flag == 1) {
              this_.dataForm.flag = res.data.flag;
              this_.whetherPicList.push("带图");
              this_.dataForm.havePictureMaxNum = res.data.giveGrowthNum;
              this_.dataForm.havePictureGiveGrowthNum =
                res.data.giveGrowthMaxNum;
            }
            if (res.data.flag == 2) {
              this_.dataForm.flag = res.data.flag;
              this_.whetherPicList.push("不带图");
              this_.dataForm.giveGrowthMaxNum = res.data.giveGrowthMaxNum;
              this_.dataForm.giveGrowthNum = res.data.giveGrowthNum;
            }
            if (res.data.flag == 3) {
              this_.dataForm.flag = res.data.flag;
              this_.whetherPicList.push("带图");
              this_.whetherPicList.push("不带图");
              this_.dataForm.havePictureMaxNum = res.data.havePictureMaxNum;
              this_.dataForm.havePictureGiveGrowthNum =
                res.data.havePictureGiveGrowthNum;
              this_.dataForm.giveGrowthMaxNum = res.data.giveGrowthMaxNum;
              this_.dataForm.giveGrowthNum = res.data.giveGrowthNum;
            }
          }
          if (query.consumeMode == 1 || query.consumeMode > 8) {
            //消费抵现
            this_.dataForm.ruleId = res.data.ruleId;
            this_.dataForm.consumeIntegralMaxNum =
              res.data.consumeIntegralMaxNum;
          }
          if (query.obtainMode == 4) {
            //充值赠送
            if (1 == res.data.consumeFlag) {
              this_.dataForm.consumeFlag = "1";
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.consumeNum = res.data.consumeNum;
              this_.dataForm.giveIntegralNum = res.data.giveIntegralNum;
              this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum;
            } else {
              this_.dataForm.consumeFlag = "2";
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.giveIntegralMaxNum = res.data.giveIntegralMaxNum;
              this_.dataForm.mememberIntegraIncrement =
                res.data.mememberIntegraIncrement.length == 0
                  ? this_.dataForm.mememberIntegraIncrement
                  : res.data.mememberIntegraIncrement;
            }
          }

          if (query.consumeMode == 2) {
            //  兑换优惠券
            if (res.data.exchangeType == 1) {
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.exchangeIntegral = res.data.exchangeIntegral;
              this_.dataForm.exchangeType = 1;
              this_.dataForm.exchangeMoney = res.data.exchangeMoney;
            }
            if (res.data.exchangeType == 2) {
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.consumeIntegralNum = res.data.consumeIntegralNum;
              this_.dataForm.exchangeType = res.data.exchangeType;
              this_.dataForm.exchangeCouponRedEnvelopes =
                res.data.exchangeCouponRedEnvelopes;
            }
          }
          if (query.consumeMode == 3) {
            // 红包
            if (res.data.exchangeType == 1) {
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.exchangeIntegral = res.data.exchangeIntegral;
              this_.dataForm.exchangeType = 1;
              this_.dataForm.exchangeMoney = res.data.exchangeMoney;
            }
            if (res.data.exchangeType == 2) {
              this_.dataForm.ruleId = res.data.ruleId;
              this_.dataForm.consumeIntegralNum = res.data.consumeIntegralNum;
              this_.dataForm.exchangeType = res.data.exchangeType;
              this_.dataForm.exchangeCouponRedEnvelopes =
                res.data.exchangeCouponRedEnvelopes;
            }
          }
        }
      });
      this.editDialogVisible = true;
    },

    // 新增订单规则
    addOrderGivenStairArr() {
      if (
        this.dataForm.mememberIntegraIncrement.length != 0 &&
        this.dataForm.mememberIntegraIncrement.length > 9
      ) {
        this.$message({ message: "新增最多不超过十条", type: "error" });
        return;
      } else {
        this.dataForm.mememberIntegraIncrement.push({});
      }

      if (
        this.rulePowerForm.mememberIntegraIncrement.length != 0 &&
        this.rulePowerForm.mememberIntegraIncrement.length > 9
      ) {
        this.$message({ message: "新增最多不超过十条", type: "error" });
        return;
      } else {
        this.rulePowerForm.mememberIntegraIncrement.push({});
      }
    },
    deelteOrderGivenStairArr(index) {
      this.rulePowerForm.mememberIntegraIncrement.splice(index, 1);
      this.dataForm.mememberIntegraIncrement.splice(index, 1);
    },
    //上一步
    upStep(data) {
      if (data == 2) {
        this.activeName = "first";
      } else if (data == 3) {
        this.activeName = "second";
      }
    },
    cupStep(data) {
      // TODO
      if (data == 2) {
        this.activeName = "first";
        this.$refs.crulePowerForm.exchangeType = null;
      } else if (data == 3) {
        this.activeName = "second";
      }
    },

    //下拉选
    selectModel(id) {
      let obj = {};
      let selectModel = {};
      obj = this.obtainModeTypeList.find(item => {
        if (item.obtainMode == id) {
          this.rulePowerForm.obtainMode = id;
          this.rulePowerForm.obtainName = item.obtainName;
          this.rulePowerForm.obtainModeName = item.obtainName;

          if (item.obtainMode == 1) {
            //下单赠送
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 2) {
            //注册赠送
            this.share = false;
            this.sun = false;
            this.order = false;
            this.collection = false;
            this.praise = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 3) {
            //评价
            this.share = false;
            this.sun = false;
            this.give = false;
            this.order = false;
            this.collection = false;
            this.praise = false;
            this.recharge = false;
            this.evaluate = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 4) {
            //充值
            this.share = false;
            this.sun = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.collection = false;
            this.praise = false;
            this.recharge = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 5) {
            //分享
            this.sun = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.collection = false;
            this.praise = false;
            this.share = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 6) {
            //点赞
            this.share = false;
            this.sun = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.collection = false;
            this.collection = false;
            this.praise = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 7) {
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            //嗮单
            this.collection = false;
            this.sun = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.obtainMode == 8) {
            this.sun = false;
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.customize = false;
            this.conCustize = false;
            //收藏
            this.collection = true;
            this.conCustize = false;
          } else if (item.obtainMode > 8) {
            this.conCustize = false;
            this.sun = false;
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            //收藏
            this.collection = false;
            this.customize = true;
            this.obtainName = item.obtainName;
            this.conCustize = false;
          }
        }
      });
    },

    selectconsumeMode(id) {
      let obj = {};
      obj = this.consumeModeTypeList.find(item => {
        //model就是上面的数据源
        if (item.consumeMode == id) {
          this.crulePowerForm.consumeMode = id;
          this.crulePowerForm.consumeName = item.consumeName;
          this.crulePowerForm.obtainModeName = item.consumeName;
          this.rulePowerForm.consumeMode = id;
          if (item.consumeMode == 1) {
            //消费抵现
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.coupon = false;
            this.red = false;
            this.product = false;
            this.Pay = false;
            this.consume = true;
            this.customize = false;
            this.conCustize = false;
            this.customize = false;
          } else if (item.consumeMode == 2) {
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.Pay = false;
            this.consume = false;
            this.coupon = true;
            this.red = false;
            this.product = false;
            this.customize = false;
            this.conCustize = false;
            this.customize = false;
          } else if (item.consumeMode == 3) {
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.share = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.Pay = false;
            this.consume = false;
            this.coupon = false;
            this.red = true;
            this.product = false;
            this.customize = false;
            this.conCustize = false;
            this.customize = false;
          } else if (item.consumeMode == 4) {
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.share = false;
            this.coupon = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.order = false;
            this.consume = false;
            this.red = false;
            this.product = false;
            this.Pay = true;
            this.customize = false;
            this.conCustize = false;
          } else if (item.consumeMode > 4) {
            this.share = false;
            this.sun = false;
            this.collection = false;
            this.praise = false;
            this.share = false;
            this.coupon = false;
            this.recharge = false;
            this.evaluate = false;
            this.give = false;
            this.order = false;
            this.order = false;
            this.consume = false;
            this.red = false;
            this.product = false;
            this.Pay = false;
            this.customize = false;
            this.conCustize = true;
            this.consumeName = item.consumeName;
            this.customize = false;
          }
        }
      });
    },
    //规则获取下一步
    nextStepRulePower(data) {
      var this_ = this;
      if (data == 1) {
        if (
          "" == this.rulePowerForm.ruleName ||
          null == this.rulePowerForm.ruleName
        ) {
          this_.$message({ message: "请输入规则名称", type: "error" });
          return;
        }
        if (
          "" == this.rulePowerForm.obtainMode ||
          null == this.rulePowerForm.obtainMode
        ) {
          this_.$message({ message: "请选择获取类型", type: "error" });
          return;
        }
        this_.activeName = "second";
      } else if (data == 2) {
        this_.rulePowerForm.ruleType = 1;
        if (
          this_.rulePowerForm.obtainMode != 1 &&
          this_.rulePowerForm.obtainMode != 4 &&
          this_.rulePowerForm.obtainMode != 3
        ) {
          if (
            "" == this_.rulePowerForm.giveIntegralNum ||
            null == this_.rulePowerForm.giveIntegralNum
          ) {
            this_.$message({ message: "请输入积分规则", type: "error" });
            return;
          } else if (
            "" != this_.rulePowerForm.giveIntegralMaxNum &&
            null != this_.rulePowerForm.giveIntegralMaxNum
          ) {
            //判断每日成长上限是否为空
            if (
              Number(this_.rulePowerForm.giveIntegralNum) >
              Number(this_.rulePowerForm.giveIntegralMaxNum)
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            } else {
              let params = Object.assign({}, this_.rulePowerForm);
            }
          } else {
            let params = Object.assign({}, this_.rulePowerForm);
          }
        } else if (this_.rulePowerForm.obtainMode == 1) {
          //如果是下单赠送
          /* 先判断是否是阶梯赠送 */
          if (this_.rulePowerForm.orderFlag != 2) {
            //如果不是阶梯赠送
            if (
              "" == this_.rulePowerForm.giveIntegralNum ||
              null == this_.rulePowerForm.giveIntegralNum
            ) {
              this_.$message({ message: "请输入积分规则", type: "error" });
              return;
            } else if (
              "" == this_.rulePowerForm.consumeNum ||
              null == this_.rulePowerForm.consumeNum
            ) {
              this_.$message({ message: "请输入消费金额", type: "error" });
              return;
            } else if (null != this_.rulePowerForm.giveIntegralMaxNum) {
              if (
                Number(this_.rulePowerForm.giveIntegralNum) >
                Number(this_.rulePowerForm.giveIntegralMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.orderFlag = 1;
              }
            } else {
              let params = Object.assign({}, this_.rulePowerForm);
              params.orderFlag = 1;
            }
          } else {
            if (
              null == this_.rulePowerForm.giveIntegralMaxNum ||
              "" == this_.rulePowerForm.giveIntegralMaxNum
            ) {
              let temp = this_.rulePowerForm.mememberIntegraIncrement;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveIntegralNum ||
                  null == temp[i].giveIntegralNum ||
                  "" == temp[i].consumeNum ||
                  null == temp[i].consumeNum
                ) {
                  this_.$message({
                    message: "下单赠送积分规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
            } else {
              let temp = this_.rulePowerForm.mememberIntegraIncrement;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveIntegralNum ||
                  null == temp[i].giveIntegralNum ||
                  "" == temp[i].consumeNum ||
                  null == temp[i].consumeNum
                ) {
                  this_.$message({
                    message: "下单赠送积分规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  return;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
              let sum = Number(0);
              for (let j = 0; j < temp.length; j++) {
                sum += Number(temp[j].giveIntegralNum);
              }
              if (sum > this_.rulePowerForm.giveIntegralMaxNum) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              }
            }
            let params = Object.assign({}, this_.rulePowerForm);
            params.orderFlag = 2;
          }
        } else if (this_.rulePowerForm.obtainMode == 4) {
          //如果是充值赠送
          /* 先判断是否是阶梯赠送 */
          if (this_.rulePowerForm.consumeFlag != 2) {
            //如果不是阶梯赠送
            if (
              "" == this_.rulePowerForm.giveIntegralNum ||
              null == this_.rulePowerForm.giveIntegralNum
            ) {
              this_.$message({ message: "请输入积分规则", type: "error" });
              return;
            } else if (
              "" == this_.rulePowerForm.consumeNum ||
              null == this_.rulePowerForm.consumeNum
            ) {
              this_.$message({ message: "请输入充值金额", type: "error" });
              return;
            } else if (null != this_.rulePowerForm.giveIntegralMaxNum) {
              if (
                Number(this_.rulePowerForm.giveIntegralNum) >
                Number(this_.rulePowerForm.giveIntegralMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.consumeFlag = 1;
              }
            } else {
              let params = Object.assign({}, this_.rulePowerForm);
              params.consumeFlag = 1;
            }
          } else {
            if (
              null == this_.rulePowerForm.giveIntegralMaxNum ||
              "" == this_.rulePowerForm.giveIntegralMaxNum
            ) {
              let temp = this_.rulePowerForm.mememberIntegraIncrement;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveIntegralNum ||
                  null == temp[i].giveIntegralNum ||
                  "" == temp[i].consumeNum ||
                  null == temp[i].consumeNum
                ) {
                  this_.$message({
                    message: "充值赠送积分规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
            } else {
              let temp = this_.rulePowerForm.mememberIntegraIncrement;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveIntegralNum ||
                  null == temp[i].giveIntegralNum ||
                  "" == temp[i].consumeNum ||
                  null == temp[i].consumeNum
                ) {
                  this_.$message({
                    message: "充值赠送积分规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  return;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
              let sum = Number(0);
              for (let j = 0; j < temp.length; j++) {
                sum += Number(temp[j].giveIntegralNum);
              }
              if (sum > this_.rulePowerForm.giveIntegralMaxNum) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.consumeFlag = 2;
          }
        } else if (this_.rulePowerForm.obtainMode == 3) {
          //如果是评价赠送
          /* 先判断评价类型 */
          if(this_.whetherPicList.length==0){
            this_.$message({
                message: "至少勾选一项",
                type: "error"
              });return;
            }
          if (
            this_.whetherPicList.length == 1 &&
            this_.whetherPicList[0] == "带图"
          ) {
            if (
              "" == this_.rulePowerForm.havePictureMaxNum ||
              null == this_.rulePowerForm.havePictureMaxNum
            ) {
              this_.$message({
                message: "请输入带图评价赠送规则",
                type: "error"
              });
              return;
            } else if (null != this_.rulePowerForm.havePictureGiveGrowthNum) {
              if(null !=this_.rulePowerForm.havePictureGiveGrowthNum && "" !=this_.rulePowerForm.havePictureGiveGrowthNum){
                if (Number(this_.rulePowerForm.havePictureMaxNum) > Number(this_.rulePowerForm.havePictureGiveGrowthNum)) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
                } else {
                  let params = Object.assign({}, this_.rulePowerForm);
                  params.flag = 1;
                }
              }
            }
            let params = Object.assign({}, this_.rulePowerForm);
            params.flag = 1;
          } else if (
            this_.whetherPicList.length == 1 &&
            this_.whetherPicList[0] == "不带图"
          ) {
            if (
              "" == this_.rulePowerForm.giveGrowthNum ||
              null == this_.rulePowerForm.giveGrowthNum
            ) {
              this_.$message({
                message: "请输入不带图评价赠送规则",
                type: "error"
              });
              return;
            } else if (null != this_.rulePowerForm.giveGrowthMaxNum) {
              if(null !=this_.rulePowerForm.giveGrowthMaxNum){
                if (
                Number(this_.rulePowerForm.giveGrowthNum) >
                Number(this_.rulePowerForm.giveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.flag = 2;
              }
              }
            }
            let params = Object.assign({}, this_.rulePowerForm);
            params.flag = 2;
          } else {
            if (null == this_.rulePowerForm.havePictureMaxNum || null == this_.rulePowerForm.giveGrowthNum) {
              this_.$message({ message: "请输入评价赠送规则", type: "error" });
              return;
            } else if (
              null != this_.rulePowerForm.havePictureGiveGrowthNum &&
              "" != this_.rulePowerForm.havePictureGiveGrowthNum &&
              null != this_.rulePowerForm.giveGrowthMaxNum &&
              "" != this_.rulePowerForm.giveGrowthMaxNum
            ) {
              if (
                Number(this_.rulePowerForm.havePictureMaxNum) >
                Number(this_.rulePowerForm.havePictureGiveGrowthNum)  ||
                Number(this_.rulePowerForm.giveGrowthNum) >
                Number(this_.rulePowerForm.giveGrowthMaxNum)  
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.flag = 3;
              }
            } else if (null != this_.rulePowerForm.giveGrowthMaxNum && "" != this_.rulePowerForm.giveGrowthMaxNum) {
              if (
                Number(this_.rulePowerForm.giveGrowthNum) >
                Number(this_.rulePowerForm.giveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.flag = 3;
              }
            } else {
              if(null !=this_.rulePowerForm.havePictureGiveGrowthNum){
                if (Number(this_.rulePowerForm.havePictureMaxNum) > Number(this_.rulePowerForm.havePictureGiveGrowthNum)) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.rulePowerForm);
                params.flag = 3;
              }
              }
            }
            let params = Object.assign({}, this_.rulePowerForm);
            params.flag = 3;
          }
        } else if (this_.rulePowerForm.obtainMode > 8) {
          if (
            "" == this_.rulePowerForm.giveIntegralNum ||
            null == this_.rulePowerForm.giveIntegralNum
          ) {
            this_.$message({ message: "请输入积分规则", type: "error" });
            return;
          } else if (
            "" != this_.rulePowerForm.giveIntegralMaxNum &&
            null != this_.rulePowerForm.giveIntegralMaxNum
          ) {
            //判断每日成长上限是否为空
            if (
              Number(this_.rulePowerForm.giveIntegralNum) >
              Number(this_.rulePowerForm.giveIntegralMaxNum)
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            } else {
              let params = Object.assign({}, this_.rulePowerForm);
            }
          } else {
            let params = Object.assign({}, this_.rulePowerForm);
          }
        }
        /* 判断是否带图 */
        if (
          this_.whetherPicList.length == 1 &&
          this_.whetherPicList[0] == "带图"
        ) {
          this_.rulePowerForm.flag = 1;
        } else if (
          this_.whetherPicList.length == 1 &&
          this_.whetherPicList[0] == "不带图"
        ) {
          this_.rulePowerForm.flag = 2;
        } else {
          this_.rulePowerForm.flag = 3;
        }
        let params = Object.assign({}, this_.rulePowerForm);

        params = Object.assign({}, this_.rulePowerForm);
        params.storeMember=2;
        params.giveGrowthMaxNum = params.giveGrowthMaxNum == ""? 0 : params.giveGrowthMaxNum;
        params.giveIntegralMaxNum = params.giveIntegralMaxNum == ""? 0 : params.giveIntegralMaxNum;
        params.havePictureMaxNum  = params.havePictureMaxNum == ""? 0 : params.havePictureMaxNum;
        params.obtainMode = this_.rulePowerForm.obtainMode;
        if (params.ruleId != null && params.ruleId != "") {

          this.obtainModeTypeList.find(item => {
            if (item.obtainName == params.obtainMode) {
              params.obtainMode = item.obtainMode
            }})
          this_.utils.request.editMemberIntegraInfo(params, function(res) {
            if (res.code == "0000") {
              this_.activeName = "third";
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
          });
        } else {
          this_.utils.request.editIntegraRuleInfo(params, function(res) {
            if (res.code == "0000") {
              this_.activeName = "third";
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
          });
        }
      }
    },

    cnextStepRulePower(data) {
      
      var this_ = this;
      if (data == 1) {
        if (
          "" == this_.crulePowerForm.ruleName ||
          null == this_.crulePowerForm.ruleName
        ) {
          this_.$message({ message: "请输入规则名称", type: "error" });
          return;
        }
        if (
          "" == this_.crulePowerForm.consumeMode ||
          null == this_.crulePowerForm.consumeMode
        ) {
          this_.$message({ message: "请选择消耗类型", type: "error" });
          return;
        }
        this.activeName = "second";
      } else if (data == 2) {
        this_.crulePowerForm.ruleType = 2;
        if (this_.crulePowerForm.consumeMode == 1) {
          //消费抵现金
          if (
            "" == this_.crulePowerForm.consumeIntegralMaxNum ||
            null == this_.crulePowerForm.consumeIntegralMaxNum
          ) {
            this_.$message({ message: "积分数不能为空", type: "error" });
            return;
          }
        } else if (this_.crulePowerForm.consumeMode == 2) {
          //兑换优惠券
          var numReg = /^[0-9]+$/;
          var numRe = new RegExp(numReg);
          if (this_.crulePowerForm.exchangeType == 1) {
            this_.crulePowerForm.exchangeCouponRedEnvelopes = "";
            if (
              "" == this_.crulePowerForm.exchangeIntegral ||
              null == this_.crulePowerForm.exchangeIntegral
            ) {
              this_.$message({ message: "积分数不能为空", type: "error" });
              return;
            }
            if (
              "" == this_.crulePowerForm.exchangeMoney ||
              null == this_.crulePowerForm.exchangeMoney
            ) {
              this_.$message({ message: "金额不能为空", type: "error" });
              return;
            }
            if (!numRe.test(this_.crulePowerForm.exchangeIntegral)) {
              this_.$message({
                type: "warning",
                message: "积分值为整数",
                duration: 10000,
                showClose: true
              });
              return;
            }
            if (
              "" != this_.crulePowerForm.exchangeMoney &&
              this_.crulePowerForm.exchangeMoney != null
            ) {
              if (!numRe.test(this_.crulePowerForm.exchangeMoney)) {
                this.$message({
                  type: "warning",
                  message: "金额为整数",
                  duration: 10000,
                  showClose: true
                });
                return;
              }
            }
          } else if (this_.crulePowerForm.exchangeType == 2) {
            this_.crulePowerForm.exchangeIntegral = "";
            if (
              "" == this_.crulePowerForm.consumeIntegralNum ||
              null == this_.crulePowerForm.consumeIntegralNum
            ) {
              this_.$message({ message: "积分数不能为空", type: "error" });
              return;
            }
            if (!numRe.test(this_.crulePowerForm.consumeIntegralNum)) {
              this_.$message({
                type: "warning",
                message: "积分值为整数",
                duration: 10000,
                showClose: true
              });
              return;
            }
            if (
              "" == this_.crulePowerForm.exchangeCouponRedEnvelopes ||
              null == this_.crulePowerForm.exchangeCouponRedEnvelopes
            ) {
              this_.$message({ message: "红包编号不能为空", type: "error" });
              return;
            }
          } else if (
            "" == this_.crulePowerForm.consumeIntegralMaxNum ||
            null == this_.crulePowerForm.consumeIntegralMaxNum
          ) {
            this_.$message({
              message: "订单消耗积分上限不能为空",
              type: "error"
            });
            return;
          }
        } else if (this_.crulePowerForm.consumeMode == 3) {
          //兑换红包
          var numReg = /^[0-9]+$/;
          var numRe = new RegExp(numReg);
          if (this_.crulePowerForm.exchangeType == 1) {
            this_.crulePowerForm.exchangeCouponRedEnvelopes = "";
            if (
              "" == this_.crulePowerForm.exchangeIntegral ||
              null == this_.crulePowerForm.exchangeIntegral
            ) {
              this_.$message({ message: "积分数不能为空", type: "error" });
              return;
            }
            if (
              "" == this_.crulePowerForm.exchangeMoney ||
              null == this_.crulePowerForm.exchangeMoney
            ) {
              this_.$message({ message: "金额不能为空", type: "error" });
              return;
            }
            if (!numRe.test(this_.crulePowerForm.exchangeIntegral)) {
              this_.$message({
                type: "warning",
                message: "积分值为整数",
                duration: 10000,
                showClose: true
              });
              return;
            }
            if (
              "" != this_.crulePowerForm.exchangeMoney &&
              this_.crulePowerForm.exchangeMoney != null
            ) {
              if (!numRe.test(this_.crulePowerForm.exchangeMoney)) {
                this.$message({
                  type: "warning",
                  message: "金额为整数",
                  duration: 10000,
                  showClose: true
                });
                return;
              }
            }
          } else if (this_.crulePowerForm.exchangeType == 2) {
            this_.crulePowerForm.exchangeIntegral = "";
            if (
              "" == this_.crulePowerForm.consumeIntegralNum ||
              null == this_.crulePowerForm.consumeIntegralNum
            ) {
              this_.$message({ message: "积分数不能为空", type: "error" });
              return;
            }
            if (!numRe.test(this_.crulePowerForm.consumeIntegralNum)) {
              this_.$message({
                type: "warning",
                message: "积分值为整数",
                duration: 10000,
                showClose: true
              });
              return;
            }
            if (
              "" == this_.crulePowerForm.exchangeCouponRedEnvelopes ||
              null == this_.crulePowerForm.exchangeCouponRedEnvelopes
            ) {
              this_.$message({ message: "红包编号不能为空", type: "error" });
              return;
            }
          } else if (
            "" == this_.crulePowerForm.consumeIntegralMaxNum ||
            null == this_.crulePowerForm.consumeIntegralMaxNum
          ) {
            this_.$message({
              message: "订单消耗积分上限不能为空",
              type: "error"
            });
            return;
          }
        }

        var params = Object.assign({}, this_.crulePowerForm);
        params.storeMember=2;
        if (params.ruleId != null && params.ruleId != "") {

          this.consumeModeTypeList.find(item => {
            if (item.consumeName == params.consumeMode) {
              params.consumeMode =  item.consumeMode;
            }})

          this_.utils.request.editMemberIntegraInfo(params, function(res) {
            if (res.code == "0000") {
              this_.activeName = "third";
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
          });
        } else {
          this_.utils.request.editIntegraRuleInfo(params, function(res) {
            if (res.code == "0000") {
              this_.activeName = "third";
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
          });
        }
      }
    },
    returnRuleList: function() {
      this.rulePowerVisible = false;
      this.crulePowerVisible = false;
      this.findPage();
    },
    creturnRuleList: function() {
      this.rulePowerVisible = false;
      this.crulePowerVisible = false;
      this.findPage();
    },

    handleProhibitStatus: function(row) {
      let this_ = this;

      this.$confirm("您确定要停用该规则吗？", "提示", {
        type: "warning",
        closeOnClickModal: false
      })
        .then(() => {
          const params = {};
          params.ruleId = row.ruleId;
          params.status = 0;
          const this_ = this;
          this_.utils.request.meMemberIntegralRuleUpdateStatus(params, function(
            res
          ) {
            if (res.code === "0000") {
              this_.$message({ message: "停用成功!", type: "success" });
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
            this_.findPage();
          });
        })
        .catch(() => {});
    },
    //删除方法
    handleDeleteParams: function(row) {
      let this_ = this;

      this.$confirm("您确定要删除该规则吗？", "提示", {
        type: "warning",
        closeOnClickModal: false
      })
        .then(() => {
          const params = {};
          params.ruleId = row.ruleId;
          params.deleteFlag = 1;
          const this_ = this;
          this_.utils.request.deletMemberIntegralInfo(params, function(res) {
            if (res.code === "0000") {
              this_.$message({ message: "删除成功!", type: "success" });
            } else {
              this_.$message({
                message: "操作失败, " + res.msg,
                type: "error"
              });
            }
            this_.findPage();
          });
        })
        .catch(() => {});
    },
    handleStatus: function(row) {
      let this_ = this;

      this.$confirm("您确定要启用该规则吗？", "提示", {
        type: "warning",
        closeOnClickModal: false
      })
        .then(() => {
          const params = {};
          params.ruleId = row.ruleId;
          params.status = 1;
          params.obtainMode = row.obtainMode;
          params.consumeMode = row.consumeMode;
          const this_ = this;
          this_.utils.request.meMemberIntegralRuleStopStatus(params, function(
            res
          ) {
            if (res.code === "0000") {
              this_.$message({ message: "启用成功", type: "success" });
            }
            this_.findPage();
          });
        })
        .catch(() => {});
    },

    addRule() {
      this.$router.push({path: '/IntegraRuleAdd/'})
    },
    addConsumeRule() {
      this.addIntegraDelTitle = "添加积分消耗规则";
      this.editTypeDis = false;
      this.rulePowerVisible = false;
      (this.crulePowerVisible = true),
        (this.crulePowerForm.exchangeType = 1 + "");
      this.crulePowerForm.deptName = JSON.parse(this.deptMsg).deptName;
    },
    // 获取分页数据
    findPage: function() {
      let this_ = this;
      this.loading = true
      this.utils.request.queryMeMemberIntegralRuleList(this_.filters, function(
        res
      ) {
        if (res.code == "0000") {
          this_.tableData = res.data.rows;
          this_.totalSize = res.data.total;
          this_.loading=false;
        }
      });
    },

    queryDeptOption() {
      let query = {};
      let this_ = this;
      this_.utils.request.getAuthorDeptTree(query, function(res) {
        if (res.code == "0000") {
          this_.deptOption = res.data;
          this.filters.deptId = localStorage.getItem("deptId");
        }
      });
    },
    //获取选择框数据
    selectionChange(val) {
      this.checked = val.selections;
    },

    //弹框关闭方法
    handleClose() {
        (this.crulePowerVisible = false),
        (this.rulePowerVisible = false),
        (this.rulePowerForm = {
        consumeIntegralNum: null,
        ruleType: 1,
        orderConsume: null,
        deptName: null,
        mememberIntegraIncrement: [{ consumeNum: "", giveIntegralNum: "" }],
        consumeFlag: null,
        orderFlag: null,
        flag: null,
        share: null,
        consumeNum: null,
        phasedConsumeNum: null,
        ruleName: null,
        ruleNum: null,
        giveIntegralNum: null,
        giveIntegralMaxNum: null,
        consumeMode: null,
        obtainMode: null,
        giveGrowthMaxNum: null,
        notPictureGiveGrowthNum: null,
        havePictureMaxNum: null,
        havePictureGiveGrowthNum: null,
        giveGrowthNum: null,
        obtainModeName: null,
        exchangeType: null,
        });
      this.crulePowerForm = {
        rtypeId: null,
        ruleName: null,
        consumeMode: null,
        mode: null,
        orderConsume: null,
        consumeFlag: null,
        orderFlag:null,
        exchangeType: null,
      };
      this.whetherPicList=["",""]
      this.activeName = "first";
      this.findPage();
    },

    handleCloseEdit() {
      this.dataForm = {
        id: null,
        ruleId: null,
        deptName: null,
        ruleValue: null,
        actionType: null,
        giveMaxNum: null,
        giveNum: null,
        ruleId: null,
        ruleType: null,
        obtainMode: null,
        obtainModeName: null,
        consumeMode: null,
        consumeNum: null,
        deptName: null,
        ruleName: null,
        ruleValue: null,
        consumeFlag: null,
        orderFlag: null,
        flag: null,
        consumeFlag: null,
        exchangeType: null,
        exchangeMoney: null,
        exchangeCouponRedEnvelopes: null,
        exchangeIntegral: null,
        giveIntegralNum: null,
        consumeIntegralNum: null,
        consumeIntegralMaxNum: null,
        giveIntegralMaxNum: null,
        havePictureMaxNum: null,
        havePictureGiveGrowthNum: null,
        giveGrowthNum: null,
        giveGrowthMaxNum: null,
        mememberIntegraIncrement: [{ consumeNum: "", giveIntegralNum: "" }],
        exchangeType: 1,
      };
  
      this.whetherPicList=["",""]
      this.activeName = "first";
    },
    // 编辑,修改
    submitForm: function() {
      var this_ = this;
      if (this_.dataForm.obtainMode == 3) {
        if (this_.whetherPicList.length == 0) {
          this_.$message({
            message: "请选择赠送规则",
            type: "error"
          });
          return;
        }

        if (
          this_.whetherPicList.length == 1 &&
          this_.whetherPicList[0] == "带图"
        ) {
          if (null == this_.dataForm.havePictureMaxNum) {
            this_.$message({
              message: "请输入带图评价赠送规则",
              type: "error"
            });
            return;
          } else if (null == this_.dataForm.havePictureGiveGrowthNum) {
            this_.$message({
              message: "请输入带图评价积分或最大值",
              type: "error"
            });
            return;
          } else if (
            null != this_.dataForm.havePictureGiveGrowthNum &&
            null != this_.dataForm.havePictureMaxNum
          ) {
            if (
              this_.dataForm.havePictureMaxNum >
              this_.dataForm.havePictureGiveGrowthNum
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            }
          }
          this_.dataForm.flag = 1;
        } else if (
          this_.whetherPicList.length == 1 &&
          this_.whetherPicList[0] == "不带图"
        ) {
          if (null == this_.dataForm.giveGrowthNum) {
            this_.$message({
              message: "请输入不带图评价积分或最大值",
              type: "error"
            });
            return;
          } else if (null == this_.dataForm.giveGrowthMaxNum) {
            this_.$message({
              message: "请输入不带图评价积分或最大值",
              type: "error"
            });
            return;
          } else if (
            null != this_.dataForm.giveGrowthMaxNum &&
            null != this_.dataForm.giveGrowthNum
          ) {
            if (
              this_.dataForm.giveGrowthNum > this_.dataForm.giveGrowthMaxNum
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            }
          }
          this_.dataForm.flag = 2;
        } else {
          if (
            null == this_.dataForm.havePictureMaxNum ||
            null == this_.dataForm.havePictureGiveGrowthNum ||
            null == this_.dataForm.giveGrowthNum ||
            null == this_.dataForm.giveGrowthMaxNum
          ) {
            this_.$message({
              message: "请输入评价赠送规则",
              type: "error"
            });
            return;
          } else if (
            null != this_.dataForm.giveGrowthMaxNum &&
            null != this_.dataForm.havePictureGiveGrowthNum
          ) {
            if (
              this_.dataForm.giveGrowthNum > this_.dataForm.giveGrowthMaxNum ||
              this_.dataForm.havePictureMaxNum >
                this_.dataForm.havePictureGiveGrowthNum
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            }
          }
          this_.dataForm.flag = 3;
        }
      }
      this_.$refs.dataForm.validate(valid => {
        if (valid) {
          this_
            .$confirm("确认提交吗？", "提示", {
              closeOnClickModal: false
            })
            .then(() => {
              let params = Object.assign({}, this.dataForm);
              var this_ = this;
              this_.utils.request.editMemberIntegraInfo(params, function(res) {
                if (res.code == "0000") {
                  this_.$message({ message: "操作成功", type: "success" });
                  //this_.$refs["dataForm"].resetFields();
                  this_.editDialogVisible = false;
                  this_.activeName = "first";
                  this_.findPage();
                } else {
                  this_.$message({
                    message: "操作失败, " + res.msg,
                    type: "error"
                  });
                }
              });
            });
        }
      });
    },

    // 时间格式化
    dateFormat: function(row, column, cellValue, index) {
      return format(row[column.property]);
    },

    //重置条件
    resetForm(formName) {
      //需要校验的key
      let keys = [
        "startTime",
        "endTime",
        "ruleNum",
        "ruleName",
        "ruleType",
        "obtainMode",
        "consumeMode",
        "deptId",
        "status"
      ];
      let boo = this.seachTableUtils.checkFromIsNull(this.filters, keys);
      if (!boo) {
        return;
      }
      if (this.$refs[formName] != undefined) {
        this.$refs[formName].resetFields();
        this.filters = {
          startTime: null,
          endTime: null,
          ruleNum: null,
          ruleName: null,
          ruleType: null,
          obtainMode: null,
          consumeMode: null,
          status:null,
          start: 1,
          limit: 10
        };
        this.findPage();
      }
    },

    // 处理表格列过滤显示
    displayFilterColumnsDialog: function() {
      this.$refs.tableColumnFilterDialog.setDialogVisible(true);
    },
    // 处理表格列过滤显示
    handleFilterColumns: function(data) {
      this.filterColumns = data.filterColumns;
      this.$refs.tableColumnFilterDialog.setDialogVisible(false);
    },

    updateVal() {
      this.$forceUpdate();
    },

  },
  mounted() {
    this.findPage();
    this.queryDeptOption();
  }
};
</script>
<style scoped lang="scss">
.type {
  display: flex;
  align-items: center;
}
.type p {
  text-align: right;
  margin-right: 20px;
  width: 120px;
}
.newUserOrder {
  margin-top: 2%;
  width: 20%;
  margin-left: 2%;
}
.font {
  font-size: 18px;
  font-weight: 800;
}
.ruleDes {
  color: #ffdead;
  font-size: 20px;
}
.positionDes {
  text-align: center;
  margin-top: 2%;
}
.ruleClass {
  font-size: 30px;
}
.everyCostHandleSel {
  /deep/ .el-input {
    width: 20%;
  }
}
.longInput {
  .timePicker {
    /deep/ .el-input {
      width: 201px !important;
    }
  }
}
.alignment {
  display: inline-block;
  height: 32px;
  line-height: 32px;
  font-size: 16px;
}

.input100 {
  /deep/ .el-input {
    width: 82px !important;
  }
}
.mb18 {
  margin-bottom: 18px;
}

.mt18 {
  margin-top: 18px;
}

// dialog标题的样式问题
.span-title {
  font-size: 28px;
  color: #333333;
}
//下拉选择框icon对齐
.iconAlignment {
  /deep/ .el-input__icon {
    line-height: 32px !important;
  }
}
.mb120 {
  margin-bottom: 120px !important;
}
.mr60 {
  margin-right: 60px !important;
}
/deep/ .w138 {
  width: 138px !important;
  /deep/ .el-input__inner {
    width: 138px !important;
  }
}
/deep/ .w350 {
  width: 350px !important;
  .el-input__inner {
    width: 350px !important;
  }
}
/deep/ .w365 {
  width: 365px !important;
  .el-input__inner {
    width: 365px !important;
  }
}
.textRed {
  color: red !important;
}
.noMarginL {
  margin-left: 0 !important;
}
.w70 {
  display: inline-block;
  width: 70px !important;
}
.colorOrange {
  color: #e7aa4e !important;
}
.turnInlineBlock {
  display: inline-block !important;
}
.successImg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
/deep/ .w115 {
  display: inline-block;
  width: 110px;
  text-align: right;
}

.mb40 {
  margin-bottom: 40px;
}
.labelText {
  color: #999999;
  font-size: 16px;
}
.w125 {
  display: inline-block;
  width: 125px;
  text-align: right;
}
.w90 {
  display: inline-block;
  width: 90px;
  text-align: right;
}
/deep/ .editDialogInput125 {
  width: 120px !important;
  /deep/ .el-input__inner {
    width: 120px !important;
  }
}
/deep/ .editDialogInput78 {
  width: 71px !important;
  /deep/ .el-input__inner {
    width: 71px !important;
  }
}
/deep/ .w275 {
  width: 275px !important;
  /deep/ .el-input__inner {
    width: 275px !important;
  }
}
.color000 {
  color: #000000;
}
.color333 {
  color: #333333;
}
.color666 {
  color: #666666;
}
.textColAlignment {
  display: inline-block;
  height: 32px;
  line-height: 32px;
}
.labelNoHeight {
  /deep/ .el-form-item__label {
    height: 0 !important;
  }
}
.p_d40 {
  padding-left: 21px;
}
.w200 {
  /deep/ .el-input {
    width: 200px !important;
    /deep/ .el-input__inner {
      width: 200px !important;
    }
  }
}
.errorInfoPosition {
  /deep/ .el-form-item__error {
    left: 112px;
  }
}
.labelTextColor666 {
  /deep/ .el-form-item__label {
    color: #666666;
  }
}
.formItemNoMargin {
  margin-bottom: 0 !important;
}
.form-item-content-noMargin {
  /deep/ .el-form-item__content {
    margin-right: 0 !important;
  }
}
.width280 {
  width: 280px !important;
}
.m_l5 {
  margin-left: 5px !important;
}
.m_l10 {
  margin-left: 10px !important;
}
/deep/ .textBtn {
  padding: 0 5px !important;
}
.mr5 {
  margin-right: 5px;
}
.w108 {
  width: 108px;
}
.w120 {
  width: 120px;
}
.labelMarginRight10 {
  /deep/ .el-form-item__label {
    margin-right: 10px !important;
  }
}
/deep/ .w356 {
  width: 356px !important;
  /deep/ .el-input__inner {
    width: 356px !important;
  }
}
// .el-dialog-style {
//   /deep/ .el-dialog {
//     /deep/ .el-dialog__body {

//     }
//   }
// }
.w150 {
  /deep/ .el-input {
    width: 150px !important;
    /deep/ .el-input__inner {
      width: 150px;
    }
  }
}
/deep/ .inputInner_paddingRight16 {
  /deep/ .el-input__inner {
    padding-right: 16px !important;
  }
}
.width267 {
  width: 267px !important;
}
.el-dialog-style {
  /deep/ .el-dialog {
    width: 610px;
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 40px;
    .el-dialog__body {
      // padding: 40px 0 0 0 !important;
      padding: 0;
      padding-top: 40px;

      // /deep/ .el-form-item__label {
      //     margin-right: 10px;
      //   }
      /deep/ .el-form-item__label {
        margin-right: 0 !important;
      }
    }
  }
}
.search-input {
  .times {
    .times-to {
      padding: 0 10px;
      height: 32px;
      line-height: 32px;
      color: #999;
      display: inline-block;
    }
    /deep/ .el-input {
      width: 208px !important;
      .el-input__inner {
        width: 208px !important;
      }
    }
  }
}
.specicalTable{
  /deep/ .el-button{
    margin-left: 0 !important;
  }
}
.w109{
  width: 109px;
}
.w280{
  /deep/ .el-input{
    width: 280px !important;
    .el-input__inner{
    width: 280px;
     }
  }
}
.w129{
  width: 129px;
}
</style>
